Forum Discussion

refex's avatar
refex
New Member
5 years ago
Solved

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 ...
  • Anonymous's avatar
    Anonymous
    5 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