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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ljx0648
Helper III
Helper III

Calculate Fiscal Year To Date value using a column as filter

Dear Community,

 

My company's fiscal year starts from Nov 1st each year and ends with Oct 31st as the last date every year.

 

For example, Fiscal year 2023 starts from Nov 1st, 2022 and ends with Oct 31st, 2023.

 

For all the prior years, I am using a Fiscal Year to Date dax formula with no issue:

 

FYTD_Sales = Calculate (sum(salestable[sales]),DatesYTD(datetable[date],"31/10")

 

However, I got a special request from my boss:

 

For Fiscal year 2024, we need to add Nov 1st, 2024 as the last date of the Year WITHOUT impacting all calculations of the prior years.

 

In other words, For ALL the fiscal prior fiscal 2024, I can still use the formula above.

But for fiscal 2024 I will need to create another formula from Nov 1st, 2023 to Nov 1st 2024. 

 

One of the solutions I can think of is to create a Fiscal Year Column in the data table and try to use that column to sum up Fiscal year to date value.

 

Sample data and desired result (YTD Value) below:

 

Fiscal YearYear_MonthValueYTD Value
2023Jun-2311
2023Jul-2312
2023Aug-2313
2023Sep-2314
2023Oct-2315
2024Nov-2311
2024Dec-2312
2024Jan-2413
2024Feb-2414
2024Mar-2415
2024Apr-2416
2024May-2417
2024Jun-2418
2024Jul-2419
2024Aug-24110
2024Sep-24111
2024Oct-24112
2024Nov-24113

 

May I know if someone has an idea about how to use the Fiscal Year column to get the YTD Value using DAX as per the example displayed above?

 

Any tips are appreciated.

 

Thank you!

1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

Hi @ljx0648  

Create a fiscalYear column in your datetable. Try the below code:

FiscalYear = IF(
    Calendar[Month] >= 11,
    Calendar[Year] + 1,
    Calendar[Year]
)

 

To handle the special case for Fiscal Year 2024, try the below code:

FYTD_Sales = 
VAR CurrentFiscalYear = MAX('Calendar'[FiscalYear])
RETURN
IF(
    CurrentFiscalYear = 2024,
    CALCULATE(
        SUM('Table'[Value]),
        FILTER(
            ALL('Calendar'),
            'Calendar'[FiscalYear] = 2024 &&
            'Calendar'[Date] <= MAX('Calendar'[Date])
        )
    ),
    CALCULATE(
        SUM('Table'[Value]),
        DATESYTD('Calendar'[Date], "31/10")
    )
)

I have relationship one to many from calendar to 'Table' using column Date.

 

Here is the output:

shafiz_p_0-1730865195855.png

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

View solution in original post

1 REPLY 1
shafiz_p
Super User
Super User

Hi @ljx0648  

Create a fiscalYear column in your datetable. Try the below code:

FiscalYear = IF(
    Calendar[Month] >= 11,
    Calendar[Year] + 1,
    Calendar[Year]
)

 

To handle the special case for Fiscal Year 2024, try the below code:

FYTD_Sales = 
VAR CurrentFiscalYear = MAX('Calendar'[FiscalYear])
RETURN
IF(
    CurrentFiscalYear = 2024,
    CALCULATE(
        SUM('Table'[Value]),
        FILTER(
            ALL('Calendar'),
            'Calendar'[FiscalYear] = 2024 &&
            'Calendar'[Date] <= MAX('Calendar'[Date])
        )
    ),
    CALCULATE(
        SUM('Table'[Value]),
        DATESYTD('Calendar'[Date], "31/10")
    )
)

I have relationship one to many from calendar to 'Table' using column Date.

 

Here is the output:

shafiz_p_0-1730865195855.png

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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