Forum Discussion

MrGriff's avatar
MrGriff
Frequent Visitor
5 years ago
Solved

Working out difference between rows

Hi,  How do I work out the difference between rows?    I have the below dataset but would like to create the column "Power Used" this would show me as below;   Date Name Power Power Used ...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, MrGriff 

    Please check the below picture and the formula for creating a new column.

     

     

    Power Used CC =
    VAR currentname = 'Table'[Name]
    VAR currentpower = 'Table'[Power]
    VAR nextpower =
    CALCULATE (
    MIN ( 'Table'[Power] ),
    FILTER ( 'Table', 'Table'[Name] = currentname && 'Table'[Power] > currentpower )
    )
    RETURN
    IF ( NOT ISBLANK ( nextpower ), nextpower - currentpower )
     

    Hi, My name is Jihwan Kim.


    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM