Forum Discussion

Rosh89's avatar
Rosh89
Icon for Helper I rankHelper I
3 years ago

SAMEPERIODLASTYEAR not working with DATESMTD

Hi, 

 

I have 4 DAX formulas given below. I want all the 4 to show MTD, YTD calculation and not the full month or entire year calculation.

year € and LY YTD revenue work perfectly and show proper year to date calcuation. But month € and LY MTD revenue does not show Month to date calculation and instead it shows calculation for the entire month. What could be wrong with month € and LY MTD revenue field?

 

year € = CALCULATE(SUM('shops'[Revenue]),
DATEADD(FILTER(DATESYTD('Date'[Date]), 'Date'[Date] < TODAY()), 0, YEAR))    -- is correct and calculates year to date


month € = CALCULATE(SUM('shops'[Revenue]),
DATEADD(FILTER(DATESMTD('Date'[Date]), 'Date'[Date] < TODAY()), 0, MONTH))    -- is not correct and I want it to calcuate month to date

 

LY YTD revenue = CALCULATE([year €], SAMEPERIODLASTYEAR('Date'[Date]))   -- is correct and calculates year to date

 

LY MTD revenue = CALCULATE([month €], SAMEPERIODLASTYEAR('Date'[Date]))       -- is not correct and I want it to calcuate month to date

1 Reply

  • Please add sample input images,what you are expecting,what you are getting in output. So it would be easy to add relevant response.