Forum Discussion
Cummulative Sales calculation only for previous year.
- 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] ) ) )
EktaSoni_R
Folow this pattern:
YTD LY =
CALCULATE(
CALCULATE(
[Sales Amount],
DATESYTD( 'Date'[Date] )
),
SAMEPERIODLASTYEAR( 'Date'[Date] )
)- EktaSoni_R2 years ago
Helper I
Fowmy
Above Dax is giving correct output while testing using the table view with date slicer, but the problem is when same i am using in Bar chart without any slicer, it is giving the all previous year data which is present in date table.My current requirement is there wont be any slicer for date, chart shows only for previous year cummulative value.
- Fowmy2 years ago
Super 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_R2 years ago
Helper 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.