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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
S1S0
New Member

TopN Values by Year

Hi, currently I am trying to build a bar chart that shows what the top 5 sellers are for each individual year. The problem is when i use the TopN filter with the bar chart I get the Top 5 sellers for all years and how they have trended through the years. Does anyone know how I would go about making this visual?

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @S1S0,

 

Maybe you need a measure like this.

ranks =
RANKX (
    ALL ( 'DimCustomer'[CustomerLabel] ),
    CALCULATE ( SUM ( FactSales[SalesQuantity] ) )
)

Top_N_Values_by_Year

 

Best Regards,

Dale

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

View solution in original post

4 REPLIES 4
Memphis28
Frequent Visitor

Afternoon

I appreciate this was answered quite some ago but hopefully someone can help.
I have given a rank to all my data using the method above however when apply this to a bar chart it doesn't seem to actually remove the values, only hide them.

So when a specific data entry appears in the top 5 on one year but not the next, it is leaving a space for this reason. Is there anyway to close the gap so it gives me the top 5 reasons for each year clustered together no matter what they are?

Memphis28_3-1714667176229.png

 

Thanks in advance

v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @S1S0,

 

Maybe you need a measure like this.

ranks =
RANKX (
    ALL ( 'DimCustomer'[CustomerLabel] ),
    CALCULATE ( SUM ( FactSales[SalesQuantity] ) )
)

Top_N_Values_by_Year

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BILASolution
Solution Specialist
Solution Specialist

Hi @S1S0

 

I hope this helps

 

https://1drv.ms/u/s!Avkkqin2drR5btsRt1ymAMsdrdE

 

Regards

BILASolution

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.