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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ElBucko
New Member

RANKX works until I add other columns to the table visual

Hi,

 

New here. I have a pbx file downloaded from sqlbi for rankx.

 

This contains a sales table and a product table with the following DAX

 

Sales Amount = SUMX ( Sales, Sales[Quantity] * Sales[Net Price] )
 
Ranking on Brand =
IF (
    ISINSCOPE ('Product'[Brand] ),
    RANKX ( ALLSELECTED ('Product'[Brand] ), [Sales Amount] )
)
 
Works perfectly in this scenario:
 

ElBucko_0-1706272353058.png

 

However, as soon as I add any field from the product table it ranks the brand within the category rather than only ranking the brands as above screenshot. 

ElBucko_2-1706272828484.png

 

Any help would be greatly appreciated.

 

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ElBucko ,

Here is my test data:

vheqmsft_0-1706515318083.png

Create a measure

Rank = 
VAR _T = ADDCOLUMNS('Table',"Group",RANKX(ALL('Table'),'Table'[Brand],'Table'[Brand],DESC,Dense))
RETURN
SUMX(_T,[Group])

Final output

vheqmsft_1-1706515388678.png

Best regards

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @ElBucko ,

Here is my test data:

vheqmsft_0-1706515318083.png

Create a measure

Rank = 
VAR _T = ADDCOLUMNS('Table',"Group",RANKX(ALL('Table'),'Table'[Brand],'Table'[Brand],DESC,Dense))
RETURN
SUMX(_T,[Group])

Final output

vheqmsft_1-1706515388678.png

Best regards

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

speedramps
Super User
Super User

We want to help you but your description is too vaugue. Please write it again clearly.

Please DON'T copy & paste your DAX that does not work and expect us to fathom what you want to do. That is a bit crazy. 😀

Please just give a simple non technical functional decscription of what you want, then let us suggest the solution. Thank you.

Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.

Remove any unneeded columns which may cause confussion.

Rename columns to user friendly names. 
Also provide the example desired output, with a clear step-by-step description of the calculation and process flow.
Remember not to share private data ... we don't want you to get into trouble. 😧
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.
Remember you are gerrting free expert help, so please put lots of proper effort to asking questions and providing example.

Vaugue descriptions can waste your time and ourtime.

Look foward to helping you when the above information is forthcoming

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.