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
doubles
Helper II
Helper II

RANKX with summarized table in a measure

 

I am trying to use RANKX to create a measure to rank percent changes in a summarized table with the below formula -- I am getting an error that the value for 'PercentChange' cannot be determined. Can you not rank over a summarized table in a measure?

 

RankPercentChange =
VAR MaxDate = MAX(Dates[Date])
RETURN RANKX(SUMMARIZE ( Data, [State], "AvgExpense", CALCULATE(AVERAGE ( Data[Expense] )), "AvgExpensePrevYr", CALCULATE (AVERAGE ( ResolutionData[SettlementAmount] ),Dates[Date] < MaxDate), "PercentChange", DIVIDE(AvgExpense - AvgExpensePrevYr, AvgExpensePrevYr,0) ) , [PercentChange],,DESC)

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

I'm not sure but this "pattern" works for me, this measure returns a rank from a "summarized" table, but actually I'm using GROUPBY()

var atable = a DAX statement that returns a table
return
GROUPBY(			
	ADDCOLUMNS(
	GROUPBY(
			atable
			,'dim Category'[Category]
			)
	,"the Rank",[ms Rank]
	)
	,"Value", SUMX(CURRENTGROUP(), [the Rank])
)

This is the simple RANK measure that is used inside the statement above

ms Rank = 
RANKX(
    ALLSELECTED('dim category')
    ,[one Measure]
) 

Hopefully this gives you some idea how to adjust your Measure

 

Regards,
Tom

 

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

I'm not sure but this "pattern" works for me, this measure returns a rank from a "summarized" table, but actually I'm using GROUPBY()

var atable = a DAX statement that returns a table
return
GROUPBY(			
	ADDCOLUMNS(
	GROUPBY(
			atable
			,'dim Category'[Category]
			)
	,"the Rank",[ms Rank]
	)
	,"Value", SUMX(CURRENTGROUP(), [the Rank])
)

This is the simple RANK measure that is used inside the statement above

ms Rank = 
RANKX(
    ALLSELECTED('dim category')
    ,[one Measure]
) 

Hopefully this gives you some idea how to adjust your Measure

 

Regards,
Tom

 

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Thanks -- this was helpful.

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