Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
alesya
New Member

Aggregating text measure outputs and using text measure as a legend

Hello 🙂

 

I have a dataset of different consumer studies where each row is an evaluation of a pair of products by a consumer in a specific study. My goal is to conduct t-tests to identify within each study whether the product wins, loses or is at parity with the competitor product.

 

Here is a sample :

Study_Pair_KeyStudy_IDConsumer_IDProduct_IDComp_Product_IDProduct_ScoreComp_Product_Score
1_HA_CA1C1HACA53
1_HA_CB1C1HACB54
1_HB_CA1C1HBCA13
1_HB_CB1C1HBCB14
1_HA_CA1C2HACA36
1_HA_CB1C2HACB35
1_HB_CA1C2HBCA26
1_HB_CB1C2HBCB25
2_HA_CA2C1HACA47
2_HA_CB2C1HACB46
2_HB_CA2C1HBCA67
2_HB_CB2C1HBCB66
2_HA_CA2C2HACA52
2_HA_CB2C2HACB53
2_HB_CA2C2HBCA32
2_HB_CB2C2HBCB33

 

I first created a calculated column for the score gap between 2 products:

  • Liking_Delta = Table[Product_Score]-Table[Comp_Product_Score]

 

Then I have created the following measures:

  • NoRows = COUNTROWS(Table)
  • CriticalValue_measure = T.INV(0.95, [NoRows]-1)
  • TTest_measure = DIVIDE(
    AVERAGE(Table[Liking_Delta]),
    DIVIDE(
        STDEV.P(Table[Liking_Delta]),
        SQRT(COUNTROWS('Table'))
    )
)
  • WPL_measure =
SWITCH(
    TRUE(),
    [TTest_measure] >= [CriticalValue_measure], "WIN",
    [TTest_measure] <= -[CriticalValue_measure], "LOSS",
    "PARITY"
)
 
WPL_measure gives me a correct output, and is reactive to filters I use (that I have not given here) when I put it in a matrix visual with the Product_ID and Comp_Product_ID in rows and columns. However, I would like to count the result of each unique Study_Pair_Key and show which represent "WIN", "PARITY" or "LOSS" in a barchart. I understand measures cannot be used in legends, but as I need to basically create a summary of the evaluation results and need this to be dynamic with the different filters(therefore groupings) is there another workaround I could use ? Othwerwise I will have to create a WPL result column in my dataset for each grouping I would like to visualize and this will expand my dataset a lot...
 
I have browsed the forum and saw similar questions asked,
But I cannot seem to find any solution to my problem 😞
 
Any idea how to solve this ?
 
Thank you so much in advance !!
1 REPLY 1
v-jialongy-msft
Community Support
Community Support

Hi @alesya 

 

Instead of expanding your dataset with additional columns for each grouping, you can create a calculated table that dynamically aggregates your WPL_measure results.

WPL_Summary = 
SUMMARIZE(
    'Table',
    'Table'[Study_Pair_Key],
    "WPL_Result", [WPL_measure]
)

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.