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
joshcomputer1
Helper V
Helper V

Rank on item and Month Number

 

I have a dataset that has Month number, CINUM, and a Count. I want to rank the CINUM's by count by month. So if Utilive has the highest count, then it is ranked 1 for that month. Each month, the count starts over.  I would like this to be done in a calculated column if possible.  If not, a measure will work. 

 

ss1.PNG

10 REPLIES 10
Greg_Deckler
Community Champion
Community Champion

Column = RANKX(FILTER(ALL('Table'),[Month]=EARLIER([Month])),[Count])


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...

CINUM Rank = rankx(filter(all('CI Grouped'),[Month]= earlier([Month])),[Sum Count])

 

I get the error : earlier refers to an earlier row context which doesn't exist. 

Hi @joshcomputer1,

 

What is [Sum Count]? Measure or calculated column?

 

In addition, could you please share your desired output so that we could understand your requirement better and get the solution?

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

sum count is a measure.  The desired output is another column that has the rank of the CINUM SCRUB for that month. 

Hi @joshcomputer1,

 

Is the image in your first post the original data?

 

Could you please share your expected output look like?

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

The rank column is what we are trying to solve. It is the rank based on the count of that CINUM for the month. 

 

ss1.PNG

@joshcomputer1 I just did what @Greg_Deckler provided and it worked fine. Are you adding rank as  column not measure? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I got the earlier error  listed above when adding rankx in the data view as a calc'ed column. I would prefer a column.  When I tried this was rankx as a measure, I do not get an error, but all CINUM SCRUBs are a value of 1. 

@joshcomputer1share your DAX expression  you are using to add rank.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Cinum rank =rank(filter(all('ci grouped'), [month]=earlier([month])),'ci grouped'[count])

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
Top Kudoed Authors