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.
Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive. Screenshots of your source data are not useful.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523