Forum Discussion
Create new column for Fiscal Year
Hi all,
I have the following data in Power Bi - I have seperated the three columns up individually however I wish to create a new year column that will display the year like 2021/22 (UK Financial Year) The year starts from April - March. I have tried other methords I found on these forums but I am unable to replicate the year followed by the forward slash / and then then the 22 afterwards.
Hi JayTG123 ,
Go to Power Query, select Conditional Column, insert the code:if [Offense date.2] >= 4 then Text.Combine({Text.From([Offense date.3]),Text.From([Offense date.3]+1-2000)},"/") else Text.Combine({Text.From([Offense date.3]-1),Text.From([Offense date.3]-2000)},"/")
Pics to follow.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πare nice too.
Nathaniel
8 Replies
- Nathaniel_CCommunity Champion
Hi JayTG123 ,
Go to Power Query, select Conditional Column, insert the code:if [Offense date.2] >= 4 then Text.Combine({Text.From([Offense date.3]),Text.From([Offense date.3]+1-2000)},"/") else Text.Combine({Text.From([Offense date.3]-1),Text.From([Offense date.3]-2000)},"/")
Pics to follow.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πare nice too.
Nathaniel- Nathaniel_CCommunity Champion
Hi JayTG123 Here are the steps:
Go to Power QuerySelect Add Column
Select Custom Column
Add a title for the column
Paste the code into the box click ok
Change the column type to Text
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πare nice too.
Nathaniel- JayTG123Advocate I
Hi Nathaniel_C thank you so much for responding!! I have done exactly as you said but I am now getting an error message in the new column.. please see below:
Expression.Error: We cannot apply operator >= to types Record and Number.
Details:
Operator=>=
Left=
Offence date.2=10
Right=4