Forum Discussion

wwolfg's avatar
wwolfg
Frequent Visitor
2 years ago
Solved

Dynamically filter graph depending on Rank

Hi,   I want to create 4 time series graph that represent the rank 1, rank 2, rank 3 and rank 4.    I tried several ways with no success.   First I make a measure for the scrap quantity produce...
  • lbendlin's avatar
    2 years ago

    Your rank will be calculated on different filter contexts.  Process 5 is only #1 overall, but not for the individual rows.  So you would have to do two steps 

    - find the process that is ranked #1 overall

    - show the items for that process.

     

    Merma Rank 1 = 
    var a = summarize(ALLSELECTED(Merma),[Proceso],"sm",[Merma Kg])
    var b = maxx(TOPN(1,a,[sm]),[Proceso])
    return calculate([Merma Kg],Merma[Proceso]=b)

    For Rank 2 you need to do some extra gymnastics

    Merma Rank 2 = 
    var a = summarize(ALLSELECTED(Merma),[Proceso],"sm",[Merma Kg])
    var b = maxx(TOPN(1,TOPN(2,a,[sm]),[sm],ASC),[Proceso])
    return calculate([Merma Kg],Merma[Proceso]=b)