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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
NewbNeedHelp
Helper I
Helper I

Table with rank position for selected slicer value

Hi all! I'm trying to figure out how to display a brand's ranking across a variety of columns.

 

I am a PowerBI noob and tried to find an article that matched this use case but couldn't quite figure it out. I tried making a RankX measure, but it ends up showing as "1" in the table for each of these 3 combinations (see illustration below), as it's filtering to the Brand selected in the slicer...and of course if it's filtered to just that 1 brand, that brand will be #1 in and of itself.

 

How can I keep the rank to be among all brands in the data set, but only show it for 1 brand?

 

NewbNeedHelp_0-1676329618859.png

 

Thank you for any help!

5 REPLIES 5
v-zhangti
Community Support
Community Support

Hi, @NewbNeedHelp 

 

You can try the following methods.

Rank Measure =
RANKX ( FILTER ( ALL ( 'Table' ),
        [Category] = SELECTEDVALUE ( 'Table'[Category] )
            && [Attribute] = SELECTEDVALUE ( 'Table'[Attribute] )
    ),
    CALCULATE ( SUM ( 'Table'[Dollars] ) ),
    ,
    DESC
)

vzhangti_1-1676367304158.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

This is great - Thank you!

 

One thing I didn't mention is that some of these are in different tables.

  • Dollars is in a Fact table with 2 columns: SKU (distinct) and Dollars.
  • Category is in Dim1 table with 3 columns: SKU (distinct), Brand (not distinct), Category (not distinct).
  • Attribute is in Dim2 table with 2 columns: SKU (not distinct) and Attribute (not distinct).

How would that change the RankX measure? Sorry I didn't give this information at first, I was trying to simplify my question :-/.

 

Thank you!

Hi, @NewbNeedHelp 

 

You can try the following methods.

In Dim1 table:

Column:

Attribute = RELATED('Dim2 table'[Attribute])
Dollars = RELATED('Fact table'[Dollars])

Measure:

Rank Measure = 
RANKX ( FILTER ( ALL ( 'Dim1 table' ),
        [Category] = SELECTEDVALUE ( 'Dim1 table'[Category] )
            && [Attribute] = SELECTEDVALUE ( 'Dim1 table'[Attribute] )
    ),
    CALCULATE ( SUM ( 'Dim1 table'[Dollars] ) ),
    ,
    DESC
)

vzhangti_1-1676533343545.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Unfortunately it doesn't quite work because each SKU can have MANY attributes, not just 1.

ryan_mayu
Super User
Super User

@NewbNeedHelp 

you can try to create a rank column

rank = RANKX(FILTER('Table','Table'[Category]=EARLIER('Table'[Category])&&'Table'[Attribute]=EARLIER('Table'[Attribute])),'Table'[Dollars])

1.PNG

pls see the attachment below





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

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.