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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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