The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi all.
A case of the Fridays with a bit of a brain scratcher.
I have a set of data that I'm trying to get the sum of the "max" total of 2 line types within a table, but only for a certain "type" of column.
Example Data Below:
UNIT | QTY | LINE | TYPE |
A | 3 | 1 | 0 |
A | 3 | 1 | 0 |
A | 3 | 2 | 0 |
A | 3 | 2 | 1 |
A | 3 | 3 | 1 |
A | 3 | 3 | 1 |
A | 3 | 3 | 1 |
A | 3 | 3 | 1 |
A | 3 | 4 | 2 |
A | 3 | 4 | 2 |
A | 3 | 5 | 2 |
A | 3 | 5 | 2 |
B | 4 | 4 | 2 |
B | 4 | 4 | 2 |
B | 8 | 5 | 2 |
B | 8 | 5 | 2 |
For this I just want the total of the "MAX" qty of the Unit. But only for "Type 2"
Example of expected output below:
UNIT | QTY |
A | 6 |
B | 12 |
So essentially I just want the total of Unit A but only for Type 2. So it would take Line 3 and 4's max value and add them together.
Data has output like this due to a nice complicated join that for other queries on the dataset can't be shrunk down.
Appreciate any input on this one! (Really hope this is just a case of the Fridays!)
Solved! Go to Solution.
Excel worksheet formulas are powerful enough to resove it easily.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Excel worksheet formulas are powerful enough to resove it easily.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
This one did the trick. Many thanks!
@AlexanderPrime Try:
Measure = MAXX(FILTER('Table', [TYPE] = 2),[QTY])
User | Count |
---|---|
70 | |
67 | |
63 | |
50 | |
28 |
User | Count |
---|---|
113 | |
78 | |
64 | |
55 | |
44 |