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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
VagelisVlachos
Frequent Visitor

TOP 10 And Bottom 10 in a single Bar Chart

Hello.

Does anyone know what i have to do to saw in 1 sinlge bar chart the top 10 and the bottom 10 customers by revenue measure?

 

Thank you.

1 ACCEPTED SOLUTION

Top/Bottom =
VAR top10 =
    RANKX ( ALL ( DimCustomer[Name] ), [Gross Profit],, ASC )
VAR bot10 =
    RANKX ( ALL ( DimCustomer[Name] ), [Gross Profit],, DESC )
RETURN
    IF ( top10 <= 10 || bot10 <= 10, [Gross Profit], BLANK () )

View solution in original post

7 REPLIES 7
Tommyvhod
Helper II
Helper II

I think the easiest way is to summarize the the revenues, create a list by customer, and add a basic filter ( top 10) on the visualization ( right side where the visualizations are), and a new list with bottom 10

Yes but you will have 2 different visual.I need to have 1 single visual with the top 10 and the bottom 10.Your way has to be with 2 different.

 

thank you

Top/Bottom =
VAR top10 =
    RANKX ( ALL ( DimCustomer[Name] ), [Gross Profit],, ASC )
VAR bot10 =
    RANKX ( ALL ( DimCustomer[Name] ), [Gross Profit],, DESC )
RETURN
    IF ( top10 <= 10 || bot10 <= 10, [Gross Profit], BLANK () )
ppm1
Solution Sage
Solution Sage

Here is an example of how to do this. In my case, I only had 6 products, so did Top/Bottom 2 only, but the pattern is the same. This is a table, but if you use the adapted measures in a bar chart, only the top/bottom will show.

 

ppm1_0-1671066734787.png

Top Bottom 2 =
VAR Top2 =
    TOPN ( 2, ALLSELECTED ( 'Product'[Product] ), [Total Sales], DESC )
VAR Bottom2 =
    TOPN ( 2, ALLSELECTED ( 'Product'[Product] ), [Total Sales], ASC )
RETURN
    CALCULATE ( [Total Sales], KEEPFILTERS ( UNION ( Top2, Bottom2 ) ) )

 

Pat

 

 

Microsoft Employee

Hello.

Thanks for the reply but this not work properly. In the visual i dont any data for the bottom "10". I ve got only for the top "10". i have tried it in a table and in bar chart and nothing.

 

Top N Sum Sales =
CALCULATE (
    [Revenue],
    KEEPFILTERS ( TOPN ( 10, ALLSELECTED ( 'DimCustomer'[Name] ), [Revenue] ) )
)
 
i used this for top 10 but i can't understand what i have to do for the bottom "10"
 
thank you

 

You didn't use the whole expression from the example. Please try this measure.

Top N Sum Sales =
VAR Top10 =
    TOPN ( 10, ALLSELECTED ( 'DimCustomer'[Name] ), [Revenue], DESC )
VAR Bottom10 =
    TOPN ( 10, ALLSELECTED ( 'DimCustomer'[Name] ), [Revenue], ASC )
RETURN
    CALCULATE ( [Revenue], KEEPFILTERS ( UNION ( Top10, Bottom10 ) ) )

Pat

Microsoft Employee

I used the whole expression and didnt work for the bottom 10.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.