Forum Discussion

srb803's avatar
srb803
Frequent Visitor
2 years ago
Solved

Same month Last Year Calculation without Date Column

I have sample data below.  I have the first 3 columns in data and need the fourth column as Output using some measure. This is a SAMEPERIODLASTYEAR calculation. But I don't have a data table here an...
  • speedramps's avatar
    2 years ago

    All reports use dates, so it is really important that you always use standard dates.

    Never use bespoke dates like 

    2022 P03/Feb (P02 UK)

     

    Always use Power Query to convert them to a standard date like 01/02/2022.

    Then you can use standard YOY comparions and testing.

    Learn how here https://www.youtube.com/watch?v=CJ2y6v4mQZk 

     

    You can use Power query to convert the date like this

    = Table.AddColumn(Source, "Date", each Date.FromText(
    Text.Start([Year Period], 4) &
    Text.Middle([Year Period], 6, 2) &
    "01" ))

     

    You will have to tweak my example to convert P13 to December

    but this shows you how easy it is to use Power Query to convert besoke dates like

    2022 P03/Feb (P02 UK)

    to a standard dates

     

    Thanks for the clear description of the problem with example data. I wish everyone did that!

    Remember we are unpaid volunteers, and you have got free expert help which took a lot of effort,
    This solution works and does exactly what you asked.
    So please quickly click the [accept as solution] and the thumbs up button to leave kudos. 

    One question per ticket please. If you need to change or extend your request then please raise a new ticket.

    You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

    If you quote speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

    Please now click the [accept as solution] and the thumbs up button.  Thank you.