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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
AG_x11x
Frequent Visitor

achieving previous FY + 3 months of current FY in DAX

Hi friends,

 

I need a DAX formula for my Custom Financial year.

 

I would like to add a column  showing:

my financial year is 1st July 2022 -  30th June 2023 and dax formula should display: 1) if today's date is October or greater then show TRUE for dates falling within current financial year. 2) However, if today's date has recently entered a new financial period and current date falls within July, August, september (ie first 3 months of FY Period) then TRUE should display for dates falling within previous FY and up to dates within July, Aug, Sep of current financial year period. otherwise, false if neither of these conditions are met. 

 

Expected results if current month is August:

FYYearMonth Month NumberDesired Result
2023/20242023august8TRUE
2023/20242023july7TRUE
2022/20232022june6TRUE
2022/20232022may 5TRUE
2022/20232022april4TRUE
2022/20232022march 3TRUE
2022/20232022february 2TRUE
2022/20232022january1TRUE
2022/20232022december12TRUE
2022/20232022november11TRUE
2022/20232022october10TRUE
2022/20232022september 9TRUE
2022/20232022august8TRUE
2022/20232022july7TRUE
2021/20222022june6FALSE
2021/20222022may5FALSE
2021/20222022april 4FALSE
2021/20222022march 3FALSE
2021/20222022february 2FALSE
2021/20222022january1FALSE

 

Expected results if current month is November:

FYYearMonth Month NumberDesired Result
2023/20242023november11TRUE
2023/20242023october10TRUE
2023/20242023september 9TRUE
2023/20242023august8TRUE
2023/20242023july7TRUE
2022/20232022june6FALSE
2022/20232022may 5FALSE
2022/20232022april4FALSE
2022/20232022march 3FALSE
2022/20232022february 2FALSE
2022/20232022january1FALSE
2022/20232022december12FALSE
2022/20232022november11FALSE
2022/20232022october10FALSE
2022/20232022september 9FALSE
2022/20232022august8FALSE
2022/20232022july7FALSE
2021/20222022june6FALSE
2021/20222022may5FALSE
2021/20222022april 4FALSE
2021/20222022march 3FALSE
2021/20222022february 2FALSE
2021/20222022january1FALSE


Current script: 

Central_Calendar = ADDCOLUMNS(

CALENDAR(DATE(2022,1, 1), DATE(2030,1,1))

, "Year", YEAR([DATE])

, "MonthNumber", MONTH([DATE])

, "Month", FORMAT([DATE], "MMM")

, "Quarter", "Q " & FORMAT([DATE], "Q")

, "QuarterNumber", FORMAT([DATE], "Q")

, "Year Quarter", YEAR([Date]) & " " & "Q" & QUARTER([Date])

, "Year Quarter Sort", YEAR([Date]) & QUARTER([Date])

, "YearMonthNumber", FORMAT([DATE], "yyyy-mm")

, "Month Year", FORMAT([DATE], "MMM YY")

, "Month Year Sort", YEAR([Date]) *100 + MONTH([Date])

, "Fiscal Year", YEAR(EDATE([DATE], 6))

, "FY", "FY" & IF(MONTH([Date])<7,

YEAR([Date])-1 & "/" & FORMAT([Date], "YY"), YEAR([Date]) & "/" & FORMAT(EOMONTH([DATE], 6), "YY"))

, "Fiscal Month", MONTH(EDATE([DATE], 6))

, "Fiscal Quarter", QUARTER(EDATE([DATE], 6))

, "Fiscal Week", WEEKNUM(EDATE([DATE], 6))

, "Last 6 Months", IF(EOMONTH([DATE], 0) > EOMONTH(TODAY(), -6) && [date] <= TODAY(), TRUE())

, "Current_FY_to_Date", IF([DATE] >= DATE(YEAR(TODAY()) -1, 7, 1) && [DATE] <= TODAY(),TRUE(), FALSE())

, "Previous_FY", IF([DATE] >= DATE(YEAR(TODAY()) -2, 7,1) && [DATE] <= DATE(YEAR(TODAY()) -1, 6, 30),TRUE(), FALSE())

, "Previous_FY_Month", IF([Date] >= EDATE(TODAY(), -1) && [Date] <= EOMONTH(TODAY(), -1) && [DATE] >= DATE(YEAR(TODAY()) -1, 7,1), TRUE(), FALSE())

, "Previous_Month", IF([Date] >= EDATE(TODAY(), -1) && [Date] <= EOMONTH(TODAY(), -1), TRUE(), FALSE())
, "Current_FY_or Prev_FY_plus 2 months of current FY",
IF (
    AND(
        TODAY() >= DATE(YEAR(TODAY()), 7, 1),   // Check if today's date is between July 1 of the current fiscal year
        TODAY() <= DATE(YEAR(TODAY()), 9, 30)    // and September 30 of the current fiscal year
    ),
    OR(
       YEAR(EDATE([DATE], 6))  = YEAR(TODAY()) - 1,   // Return TRUE for dates of the previous fiscal year
        [DATE] = DATE(YEAR(TODAY()), 9, 30)   // Return TRUE for September 30 of the current fiscal year
    ),
    IF (
        AND(
            TODAY() >= DATE(YEAR(TODAY()), 10, 1),   // Check if today's date is between October 1 of the current fiscal year
            TODAY() <= DATE(YEAR(TODAY()) + 1, 6, 30)   // and June 30 of the next fiscal year
        ),
        IF (
            [DATE] >= DATE(YEAR(TODAY()) , 7, 1) && [DATE] <= TODAY()   // Return TRUE for dates of the previous fiscal year to date
            TRUE(),
            FALSE()
        ),
        FALSE   // Return FALSE if neither condition is met
    )
))

 

 

any suggestions on how to achieve this would be appreciated.

2 REPLIES 2
Anonymous
Not applicable

Hi @AG_x11x ,

Please have a try.

Custom Financial Year =
VAR CurrentMonth =
    MONTH ( TODAY () )
VAR CurrentYear =
    YEAR ( TODAY () )
VAR PreviousYear = CurrentYear - 1
VAR StartDate =
    DATE ( PreviousYear, 7, 1 )
VAR EndDate =
    DATE ( CurrentYear, 6, 30 )
VAR PreviousFYEndDate =
    DATE ( PreviousYear, 8, 31 )
VAR Result =
    IF (
        CurrentMonth >= 10,
        IF ( AND ( [Date] >= StartDate, [Date] <= EndDate ), TRUE (), FALSE () ),
        IF (
            AND ( [Date] >= DATE ( PreviousYear, 7, 1 ), [Date] <= PreviousFYEndDate ),
            TRUE (),
            FALSE ()
        )
    )
RETURN
    Result

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

 

 

 

 

 

Hi @Anonymous,
I really appreciate your help, but the results only displayed data for the previous financial year despite being in November. The correct information should cover the current financial year from July 1, 2023, to today. (i.e if greater than or equal to October of the current FY, it should show 'TRUE' for dates for the current financial year to day i.e between 1 July 2023 till today. If less than October of the current FY, it should show previous FY up until September of current FY)

Attached is the pbix file with the mentioned results. https://drive.google.com/file/d/1XEY7SJBJ5nBw_Hqs7KBI6gAcGskZxoqa/view?usp=sharing 

my current code so far but not working if it the date was e.g August:
 "Current_FY_or Prev_FY_plus 2 months of current FY",
IF (
    AND(
        TODAY() >= DATE(YEAR(TODAY()), 7, 1),   // Check if today's date is between July 1 of the current fiscal year
        TODAY() <= DATE(YEAR(TODAY()), 9, 30)    // and September 30 of the current fiscal year
    ),
    OR(
       YEAR(EDATE([DATE], 6))  = YEAR(TODAY()) - 1,   // Return TRUE for dates of the previous fiscal year
        [DATE] = DATE(YEAR(TODAY()), 9, 30)   // Return TRUE for September 30 of the current fiscal year
    ),
    IF (
        AND(
            TODAY() >= DATE(YEAR(TODAY()), 10, 1),   // Check if today's date is between October 1 of the current fiscal year
            TODAY() <= DATE(YEAR(TODAY()) + 1, 6, 30)   // and June 30 of the next fiscal year
        ),
        IF (
            [DATE] >= DATE(YEAR(TODAY()) , 7, 1) && [DATE] <= TODAY(),   // Return TRUE for dates of the previous fiscal year to date
            TRUE(),
            FALSE()
        ),
        FALSE   // Return FALSE if neither condition is met
    )
))

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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