Forum Discussion

AntonEm's avatar
AntonEm
Frequent Visitor
8 years ago

Show Top N *filtered* values in graph

Hi all,

 

pls have a look at the following graph :smileyhappy:

 

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

  • v-chuncz-msft's avatar
    v-chuncz-msft
    Icon for Community Support rankCommunity Support

    AntonEm,

     

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

    • AntonEm's avatar
      AntonEm
      Frequent Visitor

      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.

       

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

      • AntonEm's avatar
        AntonEm
        Frequent Visitor

        Any other suggestions? :smileyhappy:

  • AntonEm's avatar
    AntonEm
    Frequent Visitor

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