Forum Discussion

badger123's avatar
badger123
Resolver I
7 years ago

Top n by date

I’m using a ribbon chart visual to show the top items over time by volume. Is there a way to show the top n at each date, rather than the top n over the entire period?

E.g. top 10 in each given month, rather than top 10 based on the entire period (even if it isn’t in the top 10 in a given month).

2 Replies

  • v-danhe-msft's avatar
    v-danhe-msft
    Microsoft Employee

    Hi badger123 ,

    Based on my test, you could refer to below test:

    Sample data:

    Create below measure:

    Measure = COUNTROWS(FILTER(ALL(Table1),'Table1'[Legend]=MAX('Table1'[Legend])&&ISONORAFTER('Table1'[Value],SELECTEDVALUE(Table1[Value]),ASC,[Date],SELECTEDVALUE(Table1[Date]))))

    And set the measure in filter with below condition:

    Result:

    You could also download the pbix file to have a view.

     

    Rrgards,

    Daniel He

    • badger123's avatar
      badger123
      Resolver I

      Thanks v-danhe-msft  - this is really helpful! I can't seem to apply it to my own use case and get it to work. Here is a bit more information about my tables and desired output:

       

      Table 1  
      DatePhraseValue
      Jan-19phrase 110
      Jan-19phrase 220
      Jan-19phrase 330
      Jan-19phrase 440
      Jan-19phrase 570
      Feb-19phrase 1100
      Feb-19phrase 230
      Feb-19phrase 320
      Feb-19phrase 410
      Feb-19phrase 55
      Mar-19phrase 1150
      Mar-19phrase 220
      Mar-19phrase 330
      Mar-19phrase 440
      Mar-19phrase 5200

       

      Table 2 
      PhraseLegend
      phrase 1Category A
      phrase 2Category B
      phrase 3Category B
      phrase 2Category C
      phrase 4Category C
      phrase 5Category D
      phrase 3Category E

       

      Current approach: Tables 1 and 2 are connected by phrase. I am using the categories as the legend and summed values as the value. I'm currently using a top n filter (e.g. top 2) which is showing the top 2 based on total value over the entire period. 

       

       

      Desired output: What I'm trying to do is show the top n at each given date. So based on the sample of tables I shared, this would look something like: 

       

      DateTop 2Total Value
      Jan-19Category D70
      Jan-19Category C60
      Feb-19Category A100
      Feb-19Category B50
      Mar-19Category D200
      Mar-19Category A150