Search code examples
powerbidaxrankingrank

incorrect ranking power bi-dax


I HAVE AN ARRAY WITH THE FOLLOWING DATA

group    mat    value
 1       a1      10
         a2      23
         a3       1
         ..
         an      32

2        b1      10
         b2       2
         b3      23
         ..
         bn       1

i want to get a rank but instead of giving me values like 1 2 3 .. 10

i get the following

group    mat    value   rank
 1       a1      10     12
         a2      23     23
         a3       1     40
         ..
         an      32     3

2        b1      10     11
         b2       2     39
         b3      23     24
         ..
         bn       1     42

this is my formula:

RANKX( FILTER( 'table','table'[group]  = EARLIER('tabla'[group])),'tabla'[value], , DESC)

and I have other fields to filter such as center and date but they are not in the matrix display any idea how to change my ranking? Tanks


Solution

  • First using Transform Data, Fill down values for Group column

    enter image description here

    Then write a measure

    Measure = SUM(Data[value])
    

    Then write a Rank measure

    Rank = RANKX(ALLEXCEPT(Data, Data[group]), [Measure])
    

    If you want filter on center and date then give those columns in ALLEXCEPT filter

    Rank = RANKX(ALLEXCEPT(Data, Data[group], Data[center], Data[Date]), [Measure])
    

    enter image description here