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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Count the Number of Rows where the MAX or TOPN equals a specific number

I need to create a measure that calculates how many unique items in a table have a MAX value of a certain number. I am trying to put the results inside of a Card visual.

 

As an example, I am wanting a count of the unique IDs in the following table that have a max status of 3, which should just be a count of 1:

 

ID        Status

1001       1

1002       2

1001       3

1002       1

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

 Hi @Anonymous 

 

You can create measure Count_Max to meet your demand.

 

Count_Max = CALCULATE(DISTINCTCOUNT(Table1[Status]),FILTER(ALLSELECTED(Table1[Status]),Table1[Status]=MAX(Table1[Status])))

 

2.png

 

 

 

 

 

Here is my test pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EePkU0bR6bNFqU3SZcJ5Z14B60swKEmgtNy5Wj9G9ME2Qw?e=ee9Oe2

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xicai
Community Support
Community Support

 Hi @Anonymous 

 

You can create measure Count_Max to meet your demand.

 

Count_Max = CALCULATE(DISTINCTCOUNT(Table1[Status]),FILTER(ALLSELECTED(Table1[Status]),Table1[Status]=MAX(Table1[Status])))

 

2.png

 

 

 

 

 

Here is my test pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EePkU0bR6bNFqU3SZcJ5Z14B60swKEmgtNy5Wj9G9ME2Qw?e=ee9Oe2

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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