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
andrewa712
New Member

RANKX Help

Hello,

 

I have data sents for a Category, Date, and a Number field. What I want to do is make a Measure to Rank the categories based on the date slicers chosen on the display.  Basically what I need is:

 

Category     Value     Rank

 

And the columns for Value and Rank adjust as I select Days, Months, Years, Etc. So the default view is sum of everything, but then I want to see the ranks for the month of April in 2016, and it shows the totals and the rank of the adjusted totals for that month.

 

So far everything I tried just gives me 1s for everyone's Rank or I get an error.

 

Thank you

1 ACCEPTED SOLUTION
v-caliao-msft
Employee
Employee

@andrewa712,

 

Please use the measure below.
SumValue = SUM(Table1[Value])
Rank = IF(
            HASONEVALUE(Table1[Month])
      ,RANKX(ALLEXCEPT(Table1,Table1[Month]),Table1[SumValue])
      )

Capture.PNGCapture1.PNG

 

View solution in original post

2 REPLIES 2
v-caliao-msft
Employee
Employee

@andrewa712,

 

Please use the measure below.
SumValue = SUM(Table1[Value])
Rank = IF(
            HASONEVALUE(Table1[Month])
      ,RANKX(ALLEXCEPT(Table1,Table1[Month]),Table1[SumValue])
      )

Capture.PNGCapture1.PNG

 

MFelix
Super User
Super User

Hi @andrewa712,

 

Your rank measure should look something like this:

 

Rank = RANKX(ALLSELECTED(Table[Category]),CALCULATE(sum(Table[Value])))

Doing this you will have a rank based on the selected values from table (slicer of date) and the sum of the value.

 

Please be aware if you place any other field in your table than the Category for making the aggregations your rank will be always 1.

 

Regards,

 

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



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.