Forum Discussion
refex
5 years agoNew Member
power query M equivalent of SAMEPERIODLASTYEAR
In my report I have a measure in DAX built in this way: MonthlyValuePreviousYear = CALCULATE(SUM('myData'[MonthlyValue]), SAMEPERIODLASTYEAR('myData'[Timestamp])) for some needs which I have ...
- Anonymous5 years ago
Add a column:
= Table.AddColumn(TableName, "LastYearDate", each Date.AddYears([DateColumn, -1))
If I named that step LastYear, then I would add a join:
Table.Join(TableName, {"LastYearDate"}, LastStep, {"LastYearDate"}, JoinKind.LeftOuter)
Now your Current Dates are lined up with last years dates, along with everything from those rows.
--Nate
refex
5 years agoNew Member
It solved for me, thank you.
I'm avoiding to do this in DAX cause I need to dynamically rename the MonthlyValue based on other values and I managed to do this only in power query. Otherwise I wouldd-ve stuck with dax