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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
chonchar
Helper V
Helper V

Custom Fiscal Year with DAX

@parry2k @Erokor 

Good morning,

 

I have a very large data set spanning 7 fiscal years. I currently have an area chart that visualizes "Total Screens" on the Y-axis and "Year" on the X-axis. See below: 

chonchar_0-1697726464140.png

These "Screens" are currently grouped by the calendar year. 

 

I would like to create a custom fiscal year that runs from 10/1/2016 to 9/30/17, 10/1/2017-9/30/2018, etc. 

 

I would then like to put those custom years in place of the "Year" that is currently seen above.

 

How do you create a custom fiscal year with DAX? I would also like to name each year Contract Year 2017, Contract Year 2018, etc. 

 

Also, all of the data in this model is in a single table called "Appended Fiscals." The column name that hold the dates I want organized is called "Screened Date."

 

Any help would be appreicated. 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@chonchar if it is of type date then try to change it to this to see if it works:

 

Year = 
VAR __Date = 'Table'[Date]
VAR __Year = YEAR ( __Date ) 
VAR __StartDate = DATE ( __Year, 10, 1 ) 
VAR __EndDate = DATE ( __Year + 1, 9, 30 )
RETURN

IF  ( __Date >= __StartDate && __Date <= __EndDate, __Year + 1,  __Year )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

14 REPLIES 14
parry2k
Super User
Super User

@chonchar you can always create some dummy data that mimics your production data and it doesn't need to have all the columns because in this case, only one column is relevant. Good luck!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@chonchar there is something wrong with the data, very hard to tell what it is? Maybe share your pbix file.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Thanks for the help. I wish I could share it, but there is a ton of secret stuff in here for my job. I am just going to try and change the types until it works, else I will move on and reach out to someone internally. Thank you. 

parry2k
Super User
Super User

@chonchar you should try 2nd expression I sent to you and see if it works.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k I tried it and it is not working

parry2k
Super User
Super User

@chonchar format and data type are two different things. What is the data type of this column? You can check it in PQ.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

= Table.TransformColumnTypes(#"Appended Query",{{"Screened Date ", type datetime}})

parry2k
Super User
Super User

@chonchar if it is of type date then try to change it to this to see if it works:

 

Year = 
VAR __Date = 'Table'[Date]
VAR __Year = YEAR ( __Date ) 
VAR __StartDate = DATE ( __Year, 10, 1 ) 
VAR __EndDate = DATE ( __Year + 1, 9, 30 )
RETURN

IF  ( __Date >= __StartDate && __Date <= __EndDate, __Year + 1,  __Year )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@chonchar I have no idea what those videos are? @amitchandak  can answer that better.

 

Regarding the expression error, what is the data type of screen by column?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Date/Time fomatted as (MM/DD/YYYY)

parry2k
Super User
Super User

@chonchar Logically you should add a calendar table for the fiscal period as suggested by @amitchandak  but if you ask is just to add this contract year column then you can use following to add this column:

 

Year = 
VAR __Date = 'Table'[Date]
VAR __Year = YEAR ( __Date ) 
VAR __StartDate = DATE ( __Year, 10, 1 ) 
VAR __EndDate = DATE ( __Year + 1, 9, 30 )
RETURN
"Contract Year " & 
IF  ( __Date >= __StartDate && __Date <= __EndDate, __Year + 1,  __Year )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k @amitchandak 

Thanks. I am running into the below issue. 

chonchar_0-1697733537027.png

I don't entirely understand the calendar table solution.

 

Does that basically assign the dates 10/1/2016-9/30/2017 to the year 2017, 10/1/2017-9/30/2018 to the year 2018, etc?

 

I have been on  YouTube all morning trying to understand the distinctions.

amitchandak
Super User
Super User

@chonchar , I created few scripts in past for FY year, please check if those can help

 

https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calend...
https://medium.com/chandakamit/cheat-sheet-calendar-of-any-standard-month-just-one-variable-apart-5e...
https://amitchandak.medium.com/cheat-sheet-power-query-financial-year-calendar-5ceaacb520f1
DAX Calendar - Standard Calendar, Non-Standard Calendar, 4-4-4 Calendar
https://www.youtube.com/watch?v=IsfCMzjKTQ0&t=145s
Power BI Date Table: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=18180s

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

Thanks for the reply. I was hoping for somehting a little simpler to implement. 

Something like: 
If (screened date) ISBETWEEN 10/1/2016-9/30/2017, Return "Contract Year 2017", Else
Contract Year 2018
etc. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.