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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.