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

Finding Max value of a category by part

I have the folloiwng sample data set...

 

I need to calculate Max Sales of Customer by the part number and figure out what % of their sales are in the top customer. I have Part Number, Customer, and Sales in my data set... how do I calculate the next 2 in dax?

 

nschmidt_1-1617126245573.png

 

 

 

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @nschmidt 

Please check the below measures.

The link to the sample pbix file is down below.

 

 

 

Max Sales of Customer by Part No =
IF (
HASONEVALUE ( 'Table'[Part Number] ),
CALCULATE (
MAXX ( 'Table', 'Table'[Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Part Number] )
),
BLANK ()
)

 

Percentage of Max =
IF (
HASONEVALUE ( 'Table'[Part Number] ),
DIVIDE (
[Max Sales of Customer by Part No],
CALCULATE (
SUMX ( 'Table', 'Table'[Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Part Number] )
)
),
BLANK ()
)

 

https://www.dropbox.com/s/3g8nnszt7p0x46e/nschmidt.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Sorry i should have specified... customer and sales are on different tables with one way relationships Customer points to Sales, Part number points to sales as well 

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.

Top Solution Authors