Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
anaib
Frequent Visitor

Create FY-Month column label based on "Date" column

Hello,

I have a date column of cloud spend.  I need to present the cost based on Fiscal Year format, i.e., FY24-May-24.  Here is the magic decorder ring for the label breakdown:  Please note the Fiscal Year runs from July to June.

 

Can you please help me with how to accomplish this?

 

MonthLabel
Jul-23FY24-Jul-23
Aug-23FY24-Aug-23
Sep-23FY24-Sep-23
Oct-23FY24-Oct-23
Nov-23FY24-Nov-23
Dec-23FY24-Dec-23
Jan-24FY24-Jan-24
Feb-24FY24-Feb-24
Mar-24FY24-Mar-24
Apr-24FY24-Apr-24
May-24FY24-May-24
Jun-24FY24-Jun-24
Jul-24FY25-Jul-24
Aug-24FY25-Aug-24
Sep-24FY25-Sep-24
Oct-24FY25-Oct-24
Nov-24FY25-Nov-24
Dec-24FY25-Dec-24
1 ACCEPTED SOLUTION

@anaib 

i think you need to create that column by using DAX, not in the power query.

12.PNG

if you want to do that in PQ, you can try this

 

=if List.Contains({"Jul","Aug","Sep","Oct","Nov","Dec"} ,Text.Start([Month],3)) then "FY"&Text.From(Number.From( Text.End([Month],2))+1)&"-"&[Month] else "FY"&Text.End([Month],2)&"-"&[Month]

 

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

13 REPLIES 13
Ashish_Mathur
Super User
Super User

Hi,

Share the Date and spend columns.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur  here is the sample dataset.

 

Sampledata.xlsx

The file does not open - there is no download option

Ashish_Mathur_0-1721346233981.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

In another worksheet of the same file, show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Added a "Suggestion1" worksheet.  Kindly take a look.

anaib
Frequent Visitor

Hi @rajendraongole1 TYVM for the assistance.  I am running into the "Token Eof expected." error.  I must be doing something wrong?

 

anaib_0-1721147454347.png

 

@anaib 

i think you need to create that column by using DAX, not in the power query.

12.PNG

if you want to do that in PQ, you can try this

 

=if List.Contains({"Jul","Aug","Sep","Oct","Nov","Dec"} ,Text.Start([Month],3)) then "FY"&Text.From(Number.From( Text.End([Month],2))+1)&"-"&[Month] else "FY"&Text.End([Month],2)&"-"&[Month]

 

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you @ryan_mayu @rajendraongole1 

The DAX method worked fine.  However the columns are not sorted properly.  Can you please help?

anaib_0-1721232268146.png

It should be FYxx-Mon-Yr but I see FY24-Apr-24 is listed before FY24-Feb-24 and so forth.

@anaib 

you can try to create a sort column

sort =
var _month=SWITCH(mid('Table'[Label],6,3),"Jan",1,"Feb",2,"Mar",3,"Apr",4,"May",5,"Jun",6,"Jul",7,"Aug",8,"Sep",9,"Oct",10,"Nov",11,"Dec",12)
return "20"&mid('Table'[Label],3,2)*100+_month
 
and select lable column then sort by sort column
 
11.png




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu tyvm for the suggestion.  I am getting this error when sorting.  My sort column is called "FY-Sort", my label column is called "FY-Month" (pls note, this is also a calculated column).

 

anaib_0-1721316982304.png

 

then you modify the data from your original column

 

 

sort =
var _month=SWITCH(left('Table'[Month],3),"Jan",1,"Feb",2,"Mar",3,"Apr",4,"May",5,"Jun",6,"Jul",7,"Aug",8,"Sep",9,"Oct",10,"Nov",11,"Dec",12)
return "20"&right('Table'[Month],2)*100+_month
 
 
11.PNG
 
and set the sort column data type to whole number
 
12.PNG
 
at last sort the month column by sort column




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




anaib
Frequent Visitor

anaib_1-1721317096202.png

 

rajendraongole1
Super User
Super User

Hi @anaib - create a calculated column with fiscal year label as below

FY-Month =
VAR MonthNumber = MONTH([Date])
VAR YearNumber = YEAR([Date])
VAR FiscalYear = IF(MonthNumber >= 7, YearNumber + 1, YearNumber)
VAR ShortYear = RIGHT(FiscalYear, 2)
VAR MonthName = FORMAT([Date], "MMM")
VAR ShortYearLabel = FORMAT([Date], "yy")
RETURN "FY" & ShortYear & "-" & MonthName & "-" & ShortYearLabel
 
rajendraongole1_0-1720714404448.png

 

Hope it works

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors