Forum Discussion
Get value difference between one date and another
Good morning
I am trying to calculate the difference between values that are on a certain date and another, for example in this case I have values that range from 1 to 6 in this case, this is dynamic, it can vary, if I want to see the gain or difference between each of them and show it in an intermediate column as it could be done.
The value 1 does not have since there is no previous value to obtain the difference would be from 2 and so on difference between 1 and 2, 2 and 3...
Each of these values has a date that I would also like to know how to calculate the number of days between one date and another.
These values are mounted on a matrix
Thank you very much for the help you can give me
- Anonymous2 years ago
Hi Syndicate_Admin ,
To calculate the number of date days you can refer to the following formula, or use the Datediff function.
Difference = VAR PreviousValue = CALCULATE( MAX('Table'[Value]), FILTER( 'Table', 'Table'[Date] < EARLIER('Table'[Date]) ) ) RETURN IF('Table'[Date] = MIN('Table'[Date]),0,'Table'[Value] - PreviousValue)or:
DaysDifference = DATEDIFF('Table'[PreviousDate], 'Table'[CurrentDate], DAY)Best Regards,
Adamk KongIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi Syndicate_Admin ,
To calculate the number of date days you can refer to the following formula, or use the Datediff function.
Difference = VAR PreviousValue = CALCULATE( MAX('Table'[Value]), FILTER( 'Table', 'Table'[Date] < EARLIER('Table'[Date]) ) ) RETURN IF('Table'[Date] = MIN('Table'[Date]),0,'Table'[Value] - PreviousValue)or:
DaysDifference = DATEDIFF('Table'[PreviousDate], 'Table'[CurrentDate], DAY)Best Regards,
Adamk KongIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.