Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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 |
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
87 | |
87 | |
67 | |
49 |
User | Count |
---|---|
135 | |
112 | |
100 | |
68 | |
67 |