March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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:
PRODUCT | AMT | RANKA | RANKC | CATEGORY | |
15464 | 0.42667 | 2 | 3 | Cat1 | |
15464 | 1 | 3 | 17 | Cat2 | |
15503 | 0.8 | 5 | 7 | Cat1 | |
15538 | 0 | 2 | 2 | Cat1 | |
15538 | 0.2 | 2 | 2 | Cat1 | |
15550 | 0.1 | 7 | 37 | Cat2 | |
15550 | 0.4 | 6 | 37 | Cat2 | |
15550 | 0.6 | 6 | 37 | Cat2 |
Can I do this easily with DAX? Do I use FILTER or CALCULATETABLE? Not sure where to start...
Thanks!
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:
PRODUCT | AMT | RANK A | RANK C | CATEGORY | ERROR? |
15464 | 1 | 3 | 17 | CAT 1 | |
15503 | 0.8 | 5 | 7 | CAT2 | |
15538 | ERROR | ||||
15550 | 0.1 | 7 | 37 | CAT2 |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
89 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |