Forum Discussion

AJw1234's avatar
AJw1234
Regular Visitor
2 years ago
Solved

Help comparing last value with current one

I am struggling with what I thought would be a reasonably simple task for .  I have a  basic table which holds details of risks.  Each time the risk is updated the table is updated.  I need to be abl...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi AJw1234 ,

    You can create a measure as below to get it:

    Difference = 
    VAR _seltitle =
        SELECTEDVALUE ( 'Table'[Title] )
    VAR _seldate =
        SELECTEDVALUE ( 'Table'[Created] )
    VAR _predate =
        CALCULATE (
            MAX ( 'Table'[Created] ),
            FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Created] < _seldate )
        )
    VAR _prerating =
        CALCULATE (
            SUM ( 'Table'[CurRating] ),
            FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Created] = _predate )
        )
    RETURN
        IF ( ISBLANK ( _prerating ), BLANK (), SUM ( 'Table'[CurRating] ) - _prerating )

    Best Regards

  • AJw1234's avatar
    2 years ago

    k you so much this is just what I wanted