Forum Discussion
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
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] )
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.
4 Replies
- amitchandakSuper User
mh2587 ,
You need add an index column in power query the
a new column =
[Columnx] - Maxx(filter(Table, [Index] = earlier([Index]) -1 ),[ColumnX]) - v-henryk-mstfCommunity 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] )
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.