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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mh2587
Super User
Super User

Calculate difference between two values in same column without time intelligence

I have single integer column , trying to calculate difference without any date or year or month column 

E.g 
     Column X                            Expected Diff

           14                                           0

             9                                     14-9= 6

             3                                      9-3=6

Thank you


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @mh2587 ,

 

Create an index column and try the following formula:

Column 2 = 
VAR cur_index = 'Table'[Index]
RETURN
    IF (
        cur_index - 1 < 0,
        0,
        CALCULATE (
            MAX ( 'Table'[Column] ),
            ALL ( 'Table' ),
            'Table'[Index] = cur_index - 1
        ) - 'Table'[Column]
    )

vhenrykmstf_0-1639538198844.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

4 REPLIES 4
v-henryk-mstf
Community Support
Community Support

Hi @mh2587 ,

 

Create an index column and try the following formula:

Column 2 = 
VAR cur_index = 'Table'[Index]
RETURN
    IF (
        cur_index - 1 < 0,
        0,
        CALCULATE (
            MAX ( 'Table'[Column] ),
            ALL ( 'Table' ),
            'Table'[Index] = cur_index - 1
        ) - 'Table'[Column]
    )

vhenrykmstf_0-1639538198844.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

amitchandak
Super User
Super User

@mh2587 ,

You need add an index column in power query the

a new column =
[Columnx] - Maxx(filter(Table, [Index] = earlier([Index]) -1 ),[ColumnX])

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I tried its not working


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Thanks for the response i will try that way


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.