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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
VIPINGARG
Frequent Visitor

dynamic Max calculation

Hi Team,

 

Below is my data.

Cust_IDPriorityCountry
12341INDIA
12342INDIA
45673INDIA
45671INDIA

Country will be my filter and I want to create the pie chart where I want to show count of Cust_ID by priority but with business rule. For example: If user select INDIA from filter, then it should take max of priority by Cust_ID which is 2 and 3 respectively and pie chart show based on below data

Cust_IDPriority
12342
45673

 

@PowerBI 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @VIPINGARG ,

Like this? 

vcgaomsft_1-1681783201061.png

Please create a new measure.

Count of Id = 
VAR _max_priority =
    CALCULATE(MAX('Table'[Priority]),ALLEXCEPT('Table','Table'[Cust_ID]))
VAR _result = 
    CALCULATE(COUNT('Table'[Cust_ID]),'Table'[Priority]=_max_priority)
RETURN
    _result

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @VIPINGARG ,

Like this? 

vcgaomsft_1-1681783201061.png

Please create a new measure.

Count of Id = 
VAR _max_priority =
    CALCULATE(MAX('Table'[Priority]),ALLEXCEPT('Table','Table'[Cust_ID]))
VAR _result = 
    CALCULATE(COUNT('Table'[Cust_ID]),'Table'[Priority]=_max_priority)
RETURN
    _result

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

VIPINGARG
Frequent Visitor

@Greg_Deckler I can't use cust_ID as legend as I need to show it by Priority only and need to show the count of cust_IDs.

Greg_Deckler
Community Champion
Community Champion

@VIPINGARG So put Cust_ID in Legend and this measure, Measure = MAX('Table'[Priority]) as Values?



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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.