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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
MostVIP2023
Helper I
Helper I

Issue with Rankx in calculated column

Dear experts,

 

  When I use rankx in calculated column ,it returns 1 in all rows, would you pls advise me how to fix it?

MostVIP2023_0-1736816801290.png

 

 

1 ACCEPTED SOLUTION

@MostVIP2023 

then you can try this

 

Column =
var _sum=CALCULATE(sum('Table (2)'[金额]),ALLEXCEPT('Table (2)','Table (2)'[产品]))
var _tbl=SUMMARIZE('Table (2)','Table (2)'[产品],"total",sum('Table (2)'[金额]))
return COUNTROWS(FILTER(_tbl,[total]>=_sum))
 
11.PNG




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

Proud to be a Super User!




View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @MostVIP2023 ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

ryan_mayu
Super User
Super User

what's the expected output?

 

is this what you want?

 

Column = RANKX('Table','Table'[金额],,DESC)
 
11.PNG




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

Proud to be a Super User!




Hi @ryan_mayu ,

 

Thank you.

 

 

you are welcome





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

Proud to be a Super User!




Hi @ryan_mayu ,

 

Thanks for your quick reply, I need to rank group by the first column,Product.

 

 

@MostVIP2023 

then you can create measure 

 

Measure = sum('Table'[金额])
Measure 2 = rankx(ALLSELECTED('Table'[产品]),[Measure],,DESC)
 
11.PNG




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

Proud to be a Super User!




Hi  @ryan_mayu ,

 

I need to rank in calculated column.

 

 

@MostVIP2023 

then you can try this

 

Column =
var _sum=CALCULATE(sum('Table (2)'[金额]),ALLEXCEPT('Table (2)','Table (2)'[产品]))
var _tbl=SUMMARIZE('Table (2)','Table (2)'[产品],"total",sum('Table (2)'[金额]))
return COUNTROWS(FILTER(_tbl,[total]>=_sum))
 
11.PNG




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

Proud to be a Super User!




Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.