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
AntonEm
Frequent Visitor

Show Top N *filtered* values in graph

Hi all,

 

pls have a look at the following graph Smiley Happy2018-04-18_1547.png

 

x-axis is date, y-axis are stacked values of the sum of top 5 categories + "Other".

 

Basically my source data is the following:

Date | Value | Category

 

I achieved the upper graph by creating columns

  • ValueSum=CALCULATE(SUM(Salden[Value]);ALLEXCEPT(Salden;Salden[Category]))
  • Rank = RANKX(ALL(Salden);[ValueSum];;DESC;Dense)
  • and finally Top5Category = IF([Rank]<=5;Salden[Category];"Other")

Problem: this works nicely if no filter is applied to the graph like (show only 2017). If I apply a filter, the categories obviously remain the same.

 

My Question: I would like the Top N categories to be based on the data that is actually shown in the graph. Meaning if I filter the graph to show only values from 2017, the Top N categories should be the ones of 2017 and not of the whole time range.

 

I know who to do this if I'm showing "only" a table using measures... but I can't use measures in the graph...

 

Any suggestion/solution?

 

BR, Anton

4 REPLIES 4
AntonEm
Frequent Visitor

No one has a suggestion? Maybe a "this is just not possible" 😉

v-chuncz-msft
Community Support
Community Support

@AntonEm,

 

You may try to write a measure that returns BLANK () for those categories you don't need.

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

@v-chuncz-msft: hm my problem is, that I can't use measures as legend in the graph... it's just not possible to drag measures in to the according field.2018-04-19_1141.png

 

I assume I have to find a solution which relies on calculations!?

Any other suggestions? Smiley Happy

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.