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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.