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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
WillTickel
Frequent Visitor

Fiscal Year Calculated Columns

I'm certain there's a more elegant (and correct) way of doing this, but I'm trying to create a calculated column which gives each date a corresponding fiscal year label e..g "FY16/17"


The formula I'm curently working on is

 

Financial Year = IF(DATESBETWEEN, Dates[Dates], DATE(2016,4,1) , DATE (2017,3, 31)) , "FY16/17",

 

IF(DATESBETWEEN, Dates[Dates], DATE(2017,4,1) , DATE (2018,3, 31)) , "FY17/18",

 

IF(DATESBETWEEN, Dates[Dates], DATE(2018,4,1) , DATE (2019,3, 31)) , "FY18/19",  0)

 

It keeps responding with an error message, can anyone guide me in the right direction?

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @WillTickel,

 

Based on my test, the formula below should also work in your scenario.Smiley Happy

 

Financial Year =
VAR fy =
    IF (
        MONTH ( 'Dates'[Dates] ) <= 3,
        VALUE ( FORMAT ( 'Dates'[Dates], "YY" ) ) - 1,
        VALUE ( FORMAT ( 'Dates'[Dates], "YY" ) )
    )
RETURN
    CONCATENATE ( "FY", CONCATENATE ( fy, CONCATENATE ( "/", fy + 1 ) ) )

 

Regards

View solution in original post

8 REPLIES 8
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @WillTickel,

 

Based on my test, the formula below should also work in your scenario.Smiley Happy

 

Financial Year =
VAR fy =
    IF (
        MONTH ( 'Dates'[Dates] ) <= 3,
        VALUE ( FORMAT ( 'Dates'[Dates], "YY" ) ) - 1,
        VALUE ( FORMAT ( 'Dates'[Dates], "YY" ) )
    )
RETURN
    CONCATENATE ( "FY", CONCATENATE ( fy, CONCATENATE ( "/", fy + 1 ) ) )

 

Regards

Anonymous
Not applicable

I have written this code and am getting the error - Cannot convert value " of type text to type number. 

 
 
Fiscal Year =
VAR FY =
IF (
MONTH ( Table1[DATE] ) <= 3,
VALUE ( FORMAT ( Table1[Date], "YY" ) ) - 1,
VALUE ( FORMAT ( Table1[Date], "YY" ) )
)
RETURN
CONCATENATE ( "FY ", FY + 1 )
 
Please help!
Anonymous
Not applicable

Figured it out - the code works! However there was a blank cell in the [Date] column - it has over 5 years of data so yeah!

Switch can also do the same:

 

SWITCH(TRUE(),

Month([Date])<4,YEAR([Date])-1 &"-"&YEAR([Date]),

YEAR([Date])&"-"&YEAR([Date])+1)

 

Thx

Many Thanks @v-ljerr-msft. It worked perfectly!

dedelman_clng
Community Champion
Community Champion

DATESBETWEEN is a function that returns a table, not a true/false as to whether or not a date falls between two dates

 

I think this should work for what you're trying to do:

 

Financial Year =
IF (
    AND (
        Dates[Dates] >= DATE ( 201641 ),
        Dates[Dates] <= DATE ( 2017331 )
    ),
    "FY16/17",
    IF (
        AND (
            Dates[Dates] >= DATE ( 201741 ),
            Dates[Dates] <= DATE ( 2018331 )
        ),
        "FY17/18",
        IF (
            AND (
                Dates[Dates] >= DATE ( 201841 ),
                Dates[Dates] >= DATE ( 2019331 )
            ),
            "FY18/19",
            0
        )
    )
)

 

Hope this helps,

David

RMDNA
Solution Sage
Solution Sage

Could you post the error message?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.