Forum Discussion
EktaSoni_R
2 years agoHelper I
Cummulative Sales calculation only for previous year.
Hello, I have tried to calculated only previous year cumulative sales, But unable to achive, i have tried n number of formulas but i am unable to get the output. Below dax is giving me till todays ...
- 2 years ago
EktaSoni_R
Please try this:YTD LY = IF( YEAR( MAX( 'Date'[Date] ) ) = YEAR( TODAY()), CALCULATE( CALCULATE( [Sales Amount], DATESYTD( 'Date'[Date] ) ), SAMEPERIODLASTYEAR( 'Date'[Date] ) ) )
Fowmy
2 years agoSuper User
EktaSoni_R
I am not sure how you have used the measure on the bar chart. However, the basic idea is that you need to have a date in the x-axis it could be month, qtr or year, in the Y-axis add the this measure.
EktaSoni_R
2 years agoHelper I
Fowmy Thanks for the relpy, I have used the Mon-Year in X asix , you can see in the chart that it is showing for all the previous year, I just want to stick only to the last year.
- Fowmy2 years agoSuper User
EktaSoni_R
In that case I need to now how you want the current year to be considered if you dont select any date from the date table. IS it fine take actual current year like 2023- EktaSoni_R2 years agoHelper I
Fowmy Yes actual current year - 2023 as current year.
Thanks
- Fowmy2 years agoSuper User
EktaSoni_R
Please try this:YTD LY = IF( YEAR( MAX( 'Date'[Date] ) ) = YEAR( TODAY()), CALCULATE( CALCULATE( [Sales Amount], DATESYTD( 'Date'[Date] ) ), SAMEPERIODLASTYEAR( 'Date'[Date] ) ) )