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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Radhika2605
Helper II
Helper II

Need help to calculate top values for measure

HI Everyone!

 

I am working in a Restaurant data and I am trying to find top 2 cuisines per price range (low, medium, high). 

 

I have tried to use this measure but it doesn't seems to work-

 

Top 2 Cuisines with the Higest number of Restaurants =
CALCULATE( COUNT( 'Restaurant Cuisines'[Restaurant_ID] ),
TOPN( 2, ALL( 'Restaurant Cuisines'[Cuisine] ), COUNT( 'Restaurant Cuisines'[Restaurant_ID] ) ),
VALUES( 'Restaurant Cuisines'[Cuisine] ) )
 
When I put this in a table I get following. Left table is table which contains all the values as I have used the count property to count the number of restaurant within each category. Right side table also shows same values but instead of this I want it to have 2 values like this (just a sample)-
High   Bar                 5
High   Brewery         4
Low    American       1 
Low    Armenian      4
 
Radhika2605_1-1630568083912.png

 

 
Can you please tell me what is wrong in my measure as I have used this measure before for finding top values and it worked perfectly fine. 
This is how my model looks - 
Radhika2605_0-1630567991911.png

 

 

Thanks

Radhika

 
 
 
1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Radhika2605 ,

 

Try the following formula:

 

Measure = 
RANKX(
    ALL('Restaurant Cuisines'[Cuisine]),
    CALCULATE( COUNT('Restaurant Cuisines'[Restaurant_ID]) ),
    ,
    DESC,
    Dense
)

image.png

 


If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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-kkf-msft
Community Support
Community Support

Hi @Radhika2605 ,

 

Try the following formula:

 

Measure = 
RANKX(
    ALL('Restaurant Cuisines'[Cuisine]),
    CALCULATE( COUNT('Restaurant Cuisines'[Restaurant_ID]) ),
    ,
    DESC,
    Dense
)

image.png

 


If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors