Forum Discussion

KiranGupta15's avatar
KiranGupta15
Frequent Visitor
5 years ago
Solved

Need Delta as a column

ItemSoreRankDelta
Item110015
Item110015
Item195215
Item180320
Item110015
Item160410
Item15050
Item15050
Item2100120
Item280210
Item270330
Item280210
Item24040
Item280210
Item24040

 

HI All,

 

I m new to Power BI, I have score for every time, based on that I have calucluated by rank of score for that item.

 

now I oking for the Delta of score based on my Rank

 

Consider above table.

 

Item1 Rank1 score is 100, 2nd is 95, I need 5 as Delta (100-95) as result.

 

Appreciate your support here. Thanks 🙂 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi KiranGupta15 ,

     

    You could use earlier() function, check the measure below.

    Column = 
    var a = CALCULATE(AVERAGE('Table'[Sore]),FILTER(ALLEXCEPT('Table','Table'[Item]),'Table'[Rank]=EARLIER('Table'[Rank])+1))
    return IF(ISBLANK(a),0,'Table'[Sore]-a)

     

     

    Best Regards,

    Jay

2 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    If you want a column, you could start with this,

    on each row , filter the table to get the score (you have to use an aggregate so min,or max or average should work) of the same item where the rank is +1.

     

    Also, I think almost all the Item2 Delta in the table provided are incorrect.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi KiranGupta15 ,

     

    You could use earlier() function, check the measure below.

    Column = 
    var a = CALCULATE(AVERAGE('Table'[Sore]),FILTER(ALLEXCEPT('Table','Table'[Item]),'Table'[Rank]=EARLIER('Table'[Rank])+1))
    return IF(ISBLANK(a),0,'Table'[Sore]-a)

     

     

    Best Regards,

    Jay