Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AJw1234
Regular Visitor

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 able to see whether the risk rating is higher or lower than the previous entry

Here is a representation of my table 

TitleCreatedCurRating
TestRisk103/03/2312
TestRisk103/04/2312
TestRisk121/04/2315
TestRisk203/03/236
TestRisk219/03/2312
TestRisk204/05/234
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

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 )

vyiruanmsft_0-1696470741713.png

Best Regards

View solution in original post

AJw1234
Regular Visitor

k you so much this is just what I wanted

View solution in original post

2 REPLIES 2
AJw1234
Regular Visitor

k you so much this is just what I wanted

Anonymous
Not applicable

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 )

vyiruanmsft_0-1696470741713.png

Best Regards

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.