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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Rank issue

Hello,

I am trying to Rank Category Id from category table   as per Quantity sold in quantity sold table.
please refer the below table- 

alpha_123_0-1629099724346.png
I am using this formula- 

Rankbycateory = RANKX(ALLselected('Product'[CategoryID]),CALCULATE(SUM(QuanitySold[Qauntity Sold])))
But it's not working..Is it because of no direct relationship between the Category and quantity sold table?

Kindly advise further!

 

1 ACCEPTED SOLUTION
Radhika2605
Helper II
Helper II

Hi, 

 

Yeah I believe you should have a relationship between Category table as well as the Quanity sold table. Also, the formula looks a bit incorrect.

Once the relationship is setup properly then try using this on.  I have separated the two measures so that it becomes more clear.

Total Quanity = SUM(QuanitySold[Qauntity Sold]) 

Rankbycategory - RANKX(ALLselected('Product'[CategoryID]), [Total Quantity], , DESC)

 

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

 

Thanks

Radhika

 

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Pls check whether there is some conflict relationships between "category" and "quantity sold"?

As tested here,if you only have 3 tables with the relationships shown in original post,it works fine:

vkellymsft_0-1629268441268.pngvkellymsft_1-1629268451901.png

If you still couldnt find the problem,would you pls share your .pbix file for test?

Remember to remove the confidential information.

For my sample .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

Radhika2605
Helper II
Helper II

Hi, 

 

Yeah I believe you should have a relationship between Category table as well as the Quanity sold table. Also, the formula looks a bit incorrect.

Once the relationship is setup properly then try using this on.  I have separated the two measures so that it becomes more clear.

Total Quanity = SUM(QuanitySold[Qauntity Sold]) 

Rankbycategory - RANKX(ALLselected('Product'[CategoryID]), [Total Quantity], , DESC)

 

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

 

Thanks

Radhika

 

 

amitchandak
Super User
Super User

@Anonymous , Try making join between product and Quantity sold as 1 to Many from product to Quantity sold

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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