Forum Discussion
Calculation with multible variables in time
- 4 years ago
Hi, Anonymous
Based on the data you provide, you can try the following methods.
Current value = SUM(Data[Value])Previous value = Var PrevDate=MAXX(FILTER(ALL('Data'[Date],Data[Year]),'Data'[Date]<SELECTEDVALUE('Data'[Date])&&[Year]=SELECTEDVALUE(Data[Year])),'Data'[Date]) Var Prevalue=CALCULATE([Current value],FILTER(ALL(Data),[Date]=PrevDate)) Return PrevalueOutcome = IF([Previous value]<>BLANK(), [Current value]-[Previous value])The result of the calculation is different from the result you expect. Consider if there is a problem with your desired result calculation?
Let me give you an example.
But in your results.
Please check if there is a problem with your result calculation in Excel, thank you.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
Based on the data you provide, you can try the following methods.
Current value = SUM(Data[Value])Previous value =
Var PrevDate=MAXX(FILTER(ALL('Data'[Date],Data[Year]),'Data'[Date]<SELECTEDVALUE('Data'[Date])&&[Year]=SELECTEDVALUE(Data[Year])),'Data'[Date])
Var Prevalue=CALCULATE([Current value],FILTER(ALL(Data),[Date]=PrevDate))
Return
PrevalueOutcome = IF([Previous value]<>BLANK(), [Current value]-[Previous value])
The result of the calculation is different from the result you expect. Consider if there is a problem with your desired result calculation?
Let me give you an example.
But in your results.
Please check if there is a problem with your result calculation in Excel, thank you.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-zhangti my bad. Indeed my demo data calculation was wrong, my apologies.
This methode does work so thank you.