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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Daxtothemax
Helper I
Helper I

Difference between two values in same column

Looking for a way in Power BI to calculate the difference between values in the same column. Need the day over day change to the remaining duration. I have a formula that works but an issue has come up when durations are actually increased.  I would prefer to not show negative change and the change be based off the original duration only. Please see existing formula and example data below. 

 

Daxtothemax_0-1649275802839.png

 

Daxtothemax_1-1649275802829.png

 

 

 

 

Any help is greatly appreciated!

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Daxtothemax ,

According to your description, here's my solution.

Create a measure.

Diff2 =
VAR _Diff =
    CALCULATE (
        MAX ( 'DS'[Hrs] ),
        FILTER (
            'DS',
            'DS'[Task] = EARLIER ( 'DS'[Task] )
                && 'DS'[Date] = MINX ( ALL ( 'DS' ), 'DS'[Date] )
        )
    ) - 'DS'[Hrs]
RETURN
    IF ( _Diff < 0, 0, _Diff )

Get the expected result.

vkalyjmsft_0-1649730590900.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Daxtothemax ,

According to your description, here's my solution.

Create a measure.

Diff2 =
VAR _Diff =
    CALCULATE (
        MAX ( 'DS'[Hrs] ),
        FILTER (
            'DS',
            'DS'[Task] = EARLIER ( 'DS'[Task] )
                && 'DS'[Date] = MINX ( ALL ( 'DS' ), 'DS'[Date] )
        )
    ) - 'DS'[Hrs]
RETURN
    IF ( _Diff < 0, 0, _Diff )

Get the expected result.

vkalyjmsft_0-1649730590900.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yanjiang-msft thank you for this! It's getting closer.  The only issue is that I need the difference between each date.  So example below Task C should equal 8 comparing to the previous date.  Any ideas on this?

 

Daxtothemax_0-1649775178347.png

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.