Forum Discussion
Help with DAX query
- 5 years ago
Hi newbie9292
You can create two measures as:
Running Total = CALCULATE ( SUM('Table'[Sales]), FILTER ( ALLSELECTED('Table'[Date]), 'Table'[Date] <= MAX ('Table'[Date] ) && YEAR('Table'[Date])=YEAR(MAX('Table'[Date])) ) )Ly Running Total = CALCULATE ( SUM('Table'[Sales]), FILTER ( ALLSELECTED('Table'[Date]), 'Table'[Date] <= MAX ('Table'[Date] ) && YEAR('Table'[Date])=YEAR(MAX('Table'[Date])) && DATEADD('Table'[Date],-1,YEAR) ) )If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
Hi newbie9292
You just need to select 2020 in the slicer.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
Hello Link,
The problem is I want to visualize both 2020 and 2021 data on the same visual,
The yellow line should be the Last year 2020 data and the dark bar should represent the 2021 data like the way it is shown.
I have 2020 and 2021 data in the same data table.
- v-xulin-mstf5 years agoCommunity Support
Hi newbie9292,
In the measure I mentioned above, when 2021 is selected, Running Total returns data from 2021 and Ly Running Total returns data from 2020.
Please check.
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
- v-xulin-mstf5 years agoCommunity Support
Hi newbie9292,
Is your issue solved? If the issue has been solved, please adopt the solution to help others.
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!