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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
AlexanderPrime
Solution Supplier
Solution Supplier

Total based on combo of multiple columns and condition

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!)


Please note - I am not affiliated with Microsoft, I'm just an end user like yourself.
Just a regular guy doin' Data Science.

If my post has helped you, please don't forget to thumbs up or click "Accept as solution" if it solved your problem!
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1679083239718.png

Excel worksheet formulas are powerful enough to resove it easily.

CNENFRNL_2-1679084392140.png


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!

View solution in original post

3 REPLIES 3
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1679083239718.png

Excel worksheet formulas are powerful enough to resove it easily.

CNENFRNL_2-1679084392140.png


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!


Please note - I am not affiliated with Microsoft, I'm just an end user like yourself.
Just a regular guy doin' Data Science.

If my post has helped you, please don't forget to thumbs up or click "Accept as solution" if it solved your problem!
Greg_Deckler
Community Champion
Community Champion

@AlexanderPrime Try:

Measure = MAXX(FILTER('Table', [TYPE] = 2),[QTY])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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