Forum Discussion
Difficulty with SAMEPERIODLASTYEAR
- 9 years ago
ARe you putting in the months on the axis so that the formula has a way to break down the measure? It is doing exactly what the DAX say. It is calculating year to date sales. When you add same period last year, your measure still requests the year to date total. You would need to specify start and end dates within your same period measure to create a difinitive cut off for totals.
ARe you putting in the months on the axis so that the formula has a way to break down the measure? It is doing exactly what the DAX say. It is calculating year to date sales. When you add same period last year, your measure still requests the year to date total. You would need to specify start and end dates within your same period measure to create a difinitive cut off for totals.
Bah! Of course! I was simply comparing values on card visuals, but once I plot them on a line chart, it works.
Thanks!
- Anonymous9 years agoNot applicable
a68tbird you could potentially force it to work on a card by adding a visual level filter to the card that gives it a date context. My standard date table for instance has a column called YearDiff and a column called DayDiff. If I added two visual level filters to a card, DateTable[YearDiff] = 0 and DateTable[DayDiff] <= 0, that would make the card always start with a date context of all the days between January 1 of the current year until today.
To recreate those columns in your own table:
DateDiff = INT(DateTable[Date] - TODAY())
YearDiff = INT(YEAR(DateTable[Date]) - YEAR(TODAY()))
The past is negative numbers, the present is 0, and the future is positive. I leave MonthDiff as an exercise to the reader.