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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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