Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Create a custom Financial Year Column

Hi, 

 

I need to create a new column to record a financial year which runs from 1st September to 31st August. What I would like to have in as the out put would be, as an example, FY21/22.

 

Any idea how I can look to create this, please? I have data in my calendar table that runs from 1st Jan 2014 to 31st December 2022

 

I have found this which creates the Fiscal Year, but not too sure how I can amend this to show the year period that I need

fiscal year =

var curryear = right(year('date'[date]),2)
var lastyear = right(year('date'[date])-1,2)
var newyear = right(year('date'[date])+1,2)

var fiscalyear =

switch(
true(),
month('date'[date]) >=4,
curryear & "-" & newyear,
lastyear & "-" & curryear

)
return

fiscalyear
  • Hi, Anonymous 

     

    You can try the following methods.

    Start date of the financial year = 
    IF(MONTH([Date])<9,DATE(Year([Date])-1,9,1),DATE(Year([Date]),9,1))
    financial year = YEAR([Start date of the financial year])
    FY = 
    var curryear = right([financial year],2)
    var newyear = right([financial year]+1,2)
    return
    curryear&"-"&newyear

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • v-zhangti's avatar
    v-zhangti
    Community Support

    Hi, Anonymous 

     

    You can try the following methods.

    Start date of the financial year = 
    IF(MONTH([Date])<9,DATE(Year([Date])-1,9,1),DATE(Year([Date]),9,1))
    financial year = YEAR([Start date of the financial year])
    FY = 
    var curryear = right([financial year],2)
    var newyear = right([financial year]+1,2)
    return
    curryear&"-"&newyear

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for these formulas. I needed to calculate academic year, which is similar, but starts on July 1. This is the formula I came up with (with your help). Is it right?

       

      Academic Year =
      var spring = IF(MONTH([Grad Date])<7,Year([Grad Date]),YEAR([Grad Date])+1)
      var fall = IF(MONTH([Grad Date])<7,YEAR([Grad Date])-1,YEAR([Grad Date]))
      return fall&"-"&spring
       
      It seems like the same thing, but I don't need to calculate the first day of the year to get to this. Skip the middleman!
  • walker4545's avatar
    walker4545
    Frequent Visitor

    Hi Anonymous,

     

    I'm sure you've solved this problem long ago, but I just wanted to share my DAX solution for this below for those searching for this solution. I'm always surprised that DAX has no inbuilt function for this.

     

    Note: this code contains some redundant variables for those that want to customise the Fiscal Year format.

     

    Also, for those wanting a Fiscal Year/Financial Year beginning in July, change the LogicalTest of the IF statement in the return section to MonthNo <= 6. Always use the string variables since you're concatenating text in the RETURN statement. See bottom of post for code without comments that evaluates new FY as starting in July.

     
    Fiscal Year = 
    //Get year of date as integer and assign to variable YearYYYYInt
    VAR YearYYYYInt = 'Date Table'[Date].[Year]
    //Convert year integer to string for use in RETURN statement string
    VAR YearYYYYStr = CONVERT ( YearYYYYInt, STRING )
    //Shorten year to two characters using RIGHT function (returns string by default)
    VAR YearYY = RIGHT ( YearYYYYStr, 2 )
    //Get previous year as integer
    VAR PrevYYYYInt = YearYYYYInt - 1
    //Get previous year as string
    VAR PrevYYYYStr = CONVERT ( PrevYYYYInt, STRING )
    //Shorten previous year to two characters
    VAR PrevYY = RIGHT ( PrevYYYYStr, 2 )
    //Get following year as integer
    VAR NextYYYYInt = YearYYYYInt + 1
    //Get following year as string
    VAR NextYYYYStr = CONVERT ( NextYYYYInt, STRING )
    //Shorten following year to two characters
    VAR NextYY = RIGHT ( NextYYYYStr, 2 )
    //Get month number
    VAR MonthNo = MONTH ( 'Date Table'[Date].[Date] )
    //If month number equal to or less than 8 (August). Change to 6 for FY beginning in July
    //If true, return FY coming to an end that year
    //If not true, return FY starting that year
    RETURN IF(MonthNo <= 8, "FY" & PrevYY & "/" & YearYY, "FY" & YearYY & "/" & NextYY)
    Financial Year = 
    VAR YearYYYYInt = 'Date Table'[Date].[Year]
    VAR YearYYYYStr = CONVERT ( YearYYYYInt, STRING )
    VAR YearYY = RIGHT ( YearYYYYStr, 2 )
    VAR PrevYYYYInt = YearYYYYInt - 1
    VAR PrevYYYYStr = CONVERT ( PrevYYYYInt, STRING )
    VAR PrevYY = RIGHT ( PrevYYYYStr, 2 )
    VAR NextYYYYInt = YearYYYYInt + 1
    VAR NextYYYYStr = CONVERT ( NextYYYYInt, STRING )
    VAR NextYY = RIGHT ( NextYYYYStr, 2 )
    VAR MonthNo = MONTH ( 'Date Table'[Date].[Date] )
    RETURN IF(MonthNo <= 6, "FY" & PrevYY & "/" & YearYY, "FY" & YearYY & "/" & NextYY)