Forum Discussion
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 and need to perform the same without that.
There is a gap of 52 in TimePeriod ID for the current year to the previous year. In front of Year Period 2023 P01 I want to display the value of 2022 P01. Any help on this is highly appreciated.
| TimePeriod Id | Year Period | Sales | Output |
| 720 | 2022 P01 | 205,665,639 | |
| 721 | 2022 P02/Jan (P01 UK) | 562,029,814 | |
| 722 | 2022 P03/Feb (P02 UK) | 527,383,577 | |
| 723 | 2022 P04/Mar (P03 UK) | 565,887,301 | |
| 724 | 2022 P05/Apr (P04 UK) | 542,678,959 | |
| 725 | 2022 P06/May (P05 UK) | 562,461,640 | |
| 726 | 2022 P07/Jun (P06 UK) | 578,394,711 | |
| 727 | 2022 P08/Jul (P07 UK) | 589,874,511 | |
| 728 | 2022 P09/Aug (P08 UK) | 595,922,630 | |
| 729 | 2022 P10/Sep (P09 UK) | 571,743,337 | |
| 730 | 2022 P11/Oct (P10 UK) | 586,392,877 | |
| 731 | 2022 P12/Nov (P11 UK) | 565,781,614 | |
| 732 | 2022 P13/Dec (P12 UK) | 614,625,239 | |
| 772 | 2023 P01 | 212,356,814 | 205,665,639 |
| 773 | 2023 P02/Jan (P01 UK) | 575,469,178 | 562,029,814 |
| 774 | 2023 P03/Feb (P02 UK) | 536,807,617 | 527,383,577 |
| 775 | 2023 P04/Mar (P03 UK) | 567,604,233 | 565,887,301 |
| 776 | 2023 P05/Apr (P04 UK) | 551,113,048 | 542,678,959 |
| 777 | 2023 P06/May (P05 UK) | 569,717,273 | 562,461,640 |
| 778 | 2023 P07/Jun (P06 UK) | 570,487,557 | 578,394,711 |
| 779 | 2023 P08/Jul (P07 UK) | 588,423,582 | 589,874,511 |
| 780 | 2023 P09/Aug (P08 UK) | 589,004,529 | 595,922,630 |
| 781 | 2023 P10/Sep (P09 UK) | 558,480,144 | 571,743,337 |
| 782 | 2023 P11/Oct (P10 UK) | 569,575,618 | 586,392,877 |
| 783 | 2023 P12/Nov (P11 UK) | 563,250,912 | 565,781,614 |
| 784 | 2023 P13/Dec (P12 UK) | 528,280,049 | 614,625,239 |
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.
1 Reply
- speedrampsSuper User
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.