Hello,
I'm having trouble with the SAMEPERIODLASTYEAR DAX formula.
Each month, we get new market sales figures ('monthly export') covering the past month and up to 25 months in the past. So in December 2016, we've received data from 11/2014 until 11/2016. The monthly data doesn't contain an exact day field, only the month (ex 201611).
So I created an extra column in my query, adding as day-value "01".
I'm calculating YTD sales and sales over the past month. Also, I'm calculating last year YTD sales over the same period and last year sales for the same month. For this, I'm using the SAMEPERIODLASTYEAR() function. However, I don't have a value for all of the competitiors/products in the same period last year, so this formula gives me an error.
Current formulas:
MTD € = CALCULATE(TOTALMTD(SUM('monthly export'[ValueMSP]);'monthly export'[Date])) LY MTD € = CALCULATE([MTD €];SAMEPERIODLASTYEAR('monthly export'[Date])) YTD € = CALCULATE(TOTALYTD(SUM('monthly export'[ValueMSP]);'monthly export'[Date])) LY YTD € = CALCULATE([YTD €];SAMEPERIODLASTYEAR('monthly export'[Date]))
I also want to be able to use a filter/slicer on the month, so I can select a certain month, and it's automatically calculating the monthly sales of that month, the same month last year, the ytd sales until that month and the ytd sales until that month for last year. However, I have no idea on how to create this filter.
Would someone have an idea on how to get rid of the error and create this additional filter?
Thank you in advance!