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
philippa_f
Frequent Visitor

DAX - Need filtered table based on two separate rankings - help!

I have a table where products appear multiple times and I need to create a subset table that just has one record for each product, based on two different scores.

I need the record chosen to be that for the MAX of RankC, but if there are multiple records for the Product with the same value for Rank C, then instead I need whichever record has the MAX of RankA. If there are multiple records with equal value for RankA then I need to show an error. Sample data here:

PRODUCTAMTRANKARANKCCATEGORY 
154640.4266723Cat1 
154641317Cat2 
155030.857Cat1 
15538022Cat1 
155380.222Cat1 
155500.1737Cat2 
155500.4637Cat2 
155500.6637Cat2 

 

Can I do this easily with DAX? Do I use FILTER or CALCULATETABLE? Not sure where to start...

 

Thanks!

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @philippa_f 

Are RankA and RankC measures or calculated columns?

How do you want the error message to be displayed? Can you share your desired result in the table?

 

Best Regards,
Community Support Team _ Eason

Hi Eason

Thanks so much for responding. No, the Rank A and Rank C are not calculations, just variables in the source data. 

What I would need to see in the new table would look like this:

 

PRODUCTAMTRANK ARANK CCATEGORYERROR?
15464

1

317CAT 1 
155030.857CAT2 
15538    ERROR
155500.1737CAT2 

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.