Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Top 5 for each month

Hi Everyone, I want to show top 5 records for every month based on "Type" column for last 6 months data (Ex. Top 5 vaues for Jan , Top 5 for Feb etc) in a line graph. So based on Type field I want ...
  • v-juanli-msft's avatar
    6 years ago

    Hi Anonymous 

    One way:

    create  two measures for each type, for example for "% Processor Time", then add one measure in the visual level filter as below:

    Processor_value = CALCULATE(SUM('Table 2'[value]),FILTER('Table 2','Table 2'[name]="% Processor Time"))
    
    Processor_rank = RANKX(FILTER(ALLSELECTED('Table 2'),'Table 2'[name]="% Processor Time"&&'Table 2'[monthyear]=MAX('Table 2'[monthyear])),[Processor_value],,DESC,Dense)

    Another way:

    add filter and measure in the visual level filter

    rankall = RANKX(FILTER(ALLSELECTED('Table 2'),'Table 2'[monthyear]=MAX('Table 2'[monthyear])),CALCULATE(SUM('Table 2'[value])),,DESC,Dense)

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