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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Lowndsy
Regular Visitor

top x within top x

I am trying to replicate an Excel sheet which shows top 10 products and the top 3 "deals" for each of those top products using the top 10 filter.

 

I have this measure set up as a visual filter <= 10:

Handset Rank = rankx(ALL('LATEST MI'[Handset No Colour]),CALCULATE(COUNT('LATEST MI'[Order Id])))

 

With no extra fields I get what I expected:

 

Handset RankHandset No Colour
1iphone 5s 32gb
2samsung galaxy s6 edge
3samsung galaxy Note 8
4samsung galaxy s6
5iphone 6s plus 32gb
6iphone 6s 128gb
7iphone 6s 32gb
8samsung galaxy s7 plus
9iphone 7 64gb
10iphone 6s plus 128gb


However, when I add any extra column to the table all the ranks get set to "1" so it just displays everything.

 

It is probably looking at each product / deal combination as unique, but I am at a bit of a loss how to stop it.
I have seen a couple of people asking the same question but not managed to get any of the solutions to work.

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @Lowndsy

 

Whatever extra Column you add in the table, you have to add the same in RANKX table expression as well.

For example suppose you add 'LATEST MI' [Supplier] in the table, you will need to revise the measure as follows

Handset Rank =
RANKX (
    ALL ( 'LATEST MI'[Handset No Colour], 'LATEST MI'[Supplier] ),
    CALCULATE ( COUNT ( 'LATEST MI'[Order Id] ) )
)




Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @Lowndsy

 

Whatever extra Column you add in the table, you have to add the same in RANKX table expression as well.

For example suppose you add 'LATEST MI' [Supplier] in the table, you will need to revise the measure as follows

Handset Rank =
RANKX (
    ALL ( 'LATEST MI'[Handset No Colour], 'LATEST MI'[Supplier] ),
    CALCULATE ( COUNT ( 'LATEST MI'[Order Id] ) )
)




Regards
Zubair

Please try my custom visuals

Thanks, that definitely had an impact - I can now add more than one colums and it shows them by rank.

The next step is to have one top x ranked within another one. Is that even doable or should I just create two tables and use hard filters to point each one at the right chunk of data?

Hi @Lowndsy

 

Could you provide sample dataset what you are trying to achieve?


Regards
Zubair

Please try my custom visuals

Something like this - top 3 tariffs for each of the top 10 handsets:

Handset RankHandset No Colour
1iphone 5s 32gb
 34.99 fun tariff on Sprint
 27.99 Business vodafone
 33.49 T-mobile
2samsung galaxy s6 edge
 34.99 fun tariff on Sprint
 27.99 T-Mobile Xtra
 33.49 T-mobile Essential
3samsung galaxy Note 8
 39.99 Max tariff on Cellnet
 23.99 Personal vodafone
 36.99 fun tariff on Sprint
 etc


So 30 rows in total

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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