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
Analitika
Post Prodigy
Post Prodigy

Calculating difference per rows in different columns in Power BI

Hello,

 

I have issue calculating the difference between different column values in same table. The result in a new created column is wrong.

My data input table is here:

Analitika_0-1634196312052.png

My output result is:

Analitika_1-1634196353632.png

But expected result is:

Analitika_2-1634196377344.png

Seems wrong answers because 0.87!=-3289.13

So how solve this issue?

 

My query is here:

Analitika_3-1634196517095.png

Seems something wrong with my query.

1 REPLY 1
Anonymous
Not applicable

HI @Analitika,

You can try to use the following calculated column formulas if it helps:

column =
VAR NextDate =
    CALCULATE (
        MIN ( Table[Date] ),
        FILTER (
            Table,
            [ID] = EARLIER ( Table[ID] )
                && [OBJ_ID] = EARLIER ( Table[OBJ_ID] )
                && [Date] > EARLIER ( Table[Date] )
        )
    )
VAR CRE =
    CALCULATE (
        MAX ( Table[CRE] ),
        FILTER (
            Table,
            [ID] = EARLIER ( Table[ID] )
                && [OBJ_ID] = EARLIER ( Table[OBJ_ID] )
                && [Date] = NextDate
        )
    )
RETURN
    IF ( [DEF] <> 0, CRE - [DET] )

Regards,
Xiaoxin Sheng

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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