Forum Discussion
extract year from
- 4 years ago
Hello there naveen73 ! If I understood your situation correctly, I think this might give the result you are searching for:
= Table.AddColumn(#"Your previous step", "Year", each if Text.Start([ColumnName],1) = "Q" then Date.StartOfQuarter(Text.Start([ColumnName],2)) else Text.End(Text.From([ColumnName], Culture.Current),4))If you keep the column formatted as a Date it should work as well!
Hope this answer solves your problem! If you need any additional help please @ me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes
naveen73 is your data always in the format "QQ-YYYY"?
that is exactly the problem, sometimes it is and sometimes it is not.
- goncalogeraldes4 years agoSuper User
naveen73 are the year values always the last four?
- naveen734 years agoHelper III
yes
- goncalogeraldes4 years agoSuper User
naveen73 I will assume that it is a text column so try this then:
#"Added Custom" = Table.AddColumn(#"YourPreviousStep", "Year", each Text.End([ColumnName],4))Hope this answer solves your problem! If you need any additional help please @ me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes