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
Anonymous
Not applicable

Top 5 filtering not showing correctly

Hi,

I am trying to create a column chart to show the top 5 customers depening on the quarter. However I noticed something strange. The top 5 filtering works just fine, but only applies to the last quarter. 

Capture.PNG

In the pictures you see that the Top5 for qtr 1 2018 should be customer 1, 2, 3, 4 and 5. However as they are not the Top 5 in the last visible quarter, Power BI ommits them and shows the last Top 5 customers also in the first visible quarter.

Is there a way, or measure, to always show the top 5? Even if that means the legend will display more than 5 customers?

Thank you very much!

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

To create a calculated column as below and make it to be greater than or equal to 5.

rank = 
RANKX (
    FILTER ( 'Table', 'Table'[date] = EARLIER ( 'Table'[date] ) ),
    CALCULATE (
        SUM ( 'Table'[values] ),
        ALLEXCEPT ( 'Table', 'Table'[date], 'Table'[customer No] )
    ),
    ,
    ASC,
    DENSE
)

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

To create a calculated column as below and make it to be greater than or equal to 5.

rank = 
RANKX (
    FILTER ( 'Table', 'Table'[date] = EARLIER ( 'Table'[date] ) ),
    CALCULATE (
        SUM ( 'Table'[values] ),
        ALLEXCEPT ( 'Table', 'Table'[date], 'Table'[customer No] )
    ),
    ,
    ASC,
    DENSE
)

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hey @v-frfei-msft ,

Thank you very much for your reply. It works indeed. I was also wondering, whether it is possible to add an additional argument/ attribute. For example a city or country?

Hi  @Anonymous ,

 

To add the city or country in ALLEXCEPT.

rank = 
RANKX (
    FILTER ( 'Table', 'Table'[date] = EARLIER ( 'Table'[date] ) ),
    CALCULATE (
        SUM ( 'Table'[values] ),
        ALLEXCEPT ( 'Table', 'Table'[date], 'Table'[customer No],[CITY],[COUNTRY] )
    ),
    ,
    ASC,
    DENSE
)

If it doen't meet your requirement, kindly share your sample data to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

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.