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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hassens
Regular Visitor

Finding the Best Result Based on Multiple Criteria

Hi,

 

I have a data set similar to the one below. I want to highlight/identify the best result (where answer = 'yes') for each question for each store within a given period. Only one best result should be highlighted given the criteria above so something like the first or last best result would be fine. I have added the intended result in the last column below.

 

Visit IDStore IDQuestionAnswerPeriodDateBestRead?
1AQuestion 1Yes101/01/20171
1AQuestion 2Yes101/01/20171
2AQuestion 1Yes102/01/20170
2AQuestion 2Yes102/01/20170
3AQuestion 1Yes203/05/20171
3AQuestion 2Yes203/05/20171
1BQuestion 1Yes105/01/20171
1BQuestion 2No105/01/20170
2BQuestion 1No110/05/20170
2BQuestion 2Yes110/05/20171

 

What I have been trying is:

 

  1. Adding a column to translate all 'Yes' answers to '1', called YesRead
  2. Trying the following: BestRead = IF(Table[YesRead]=CALCULATE(MAX(Table[YesRead]),ALLEXCEPT(Table,Table[StoreID],Table[Period],Table[Question])),1,0)  which returns a 'A single value for column 'YesRead' in table 'Table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.' Also I realise this does not yet incorporate anything to highlight only one best within the criteria.

 

Any help would be appreciated!

 

Thanks Smiley Happy

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @hassens,

 

>>I want to highlight/identify the best result (where answer = 'yes') for each question for each store within a given period.

You can try to use below formula to summary records by "question" and "period".

Table = SUMMARIZE(FILTER(ALL(Sheet1),[Answer]="Yes"),[Store ID],[Question],[Period],"Total Read",SUM(Sheet1[BestRead?]))

1.PNG

 


I haven't found a way to highlight records which in the table.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.