Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Table level calculation

Hi, I am stuck with achieving table level calculation, any quick help is appreciated. it could be a measure or column    Problem is to pick the appropriate cell value and subtract it against the pr...
  • selimovd's avatar
    5 years ago

    Hey Anonymous ,

     

    I don't see a Fleet No in your example, but the following calculated column should work for the data you posted:

    myResult = 
    VAR vCurrentValue = Facttable[Value]
    VAR vCurrentIndex = Facttable[Index]
    RETURN
        IF(
            vCurrentIndex = 1,
            0,
            vCurrentValue - CALCULATE(SUM(Facttable[Value]), Facttable[Index] = vCurrentIndex - 1 , ALLEXCEPT(Facttable, Facttable[ID]))
        )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis