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
ljx0648
Helper III
Helper III

Calculate special fiscal year to date with the same beginning date & month

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. 

 

Sample Data will be 

 

DateValueFYTD Value
2023-11-01100100
2023-12-01100200
2024-01-01100300
2024-02-01100400
2024-03-01100500
2024-04-01100600
2024-05-01100700
2024-06-01100800
2024-07-01100900
2024-08-011001000
2024-10-011001100
2024-11-01501150

 

May I know if anyone can share any ideas or insights on how to solve this request?

 

Any tips are very much appreicated!

 

Thank you all

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from marcelsmaglhaes , please allow me to provide another insight:

Hi  @ljx0648 ,

I created some data:

vyangliumsft_0-1730966468664.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _table1=
SUMMARIZE(
    ALL('Table'),[Year_Month],"mindate",MINX(FILTER(ALL('Table'),[Year_Month]=EARLIER('Table'[Year_Month])),[Date]),"Sum_Value",SUMX(FILTER(ALL('Table'),[Year_Month]=EARLIER('Table'[Year_Month])),[Value]))
var _table2=
ADDCOLUMNS(
    _table1,"YTD_Value",
IF(
    YEAR([Year_Month])=2024,
    SUMX(
        FILTER(_table1,[mindate]>=DATE(YEAR([mindate])-1,11,1)&&[mindate]<=DATE(YEAR([mindate]),11,1)&&[mindate]<=EARLIER([mindate])),[Sum_Value]),
    SUMX(
        FILTER(_table1,[mindate]>=DATE(YEAR([mindate]),1,1)&&[mindate]<=DATE(YEAR([mindate]),10,31)&&[mindate]<=EARLIER([mindate])),[Sum_Value])))
RETURN
SUMX(
    FILTER(_table2,[Year_Month]=MAX('Table'[Year_Month])),[YTD_Value])

As far as I know, Power BI default sorting is alphabetical, so [Year_Month] won't follow the table order to achieve that, we need to create a table to be used as sort_table to sort.

vyangliumsft_1-1730966468665.png

2. Create calculated table.

Sort_Table =
SUMMARIZE(
    'Table',[Year_Month],"mindate",MINX(FILTER(ALL('Table'),[Year_Month]=EARLIER('Table'[Year_Month])),[Date]))

vyangliumsft_2-1730966505771.png

3. Select [Year_Month] – Column tools – Sort by column – [mindate].

vyangliumsft_3-1730966505774.png

4. Joins the relationship between two tables.

vyangliumsft_4-1730966531525.png

5. Result:

vyangliumsft_5-1730966531533.png

 

Best Regards,

Liu Yang

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks for the reply from marcelsmaglhaes , please allow me to provide another insight:

Hi  @ljx0648 ,

I created some data:

vyangliumsft_0-1730966468664.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _table1=
SUMMARIZE(
    ALL('Table'),[Year_Month],"mindate",MINX(FILTER(ALL('Table'),[Year_Month]=EARLIER('Table'[Year_Month])),[Date]),"Sum_Value",SUMX(FILTER(ALL('Table'),[Year_Month]=EARLIER('Table'[Year_Month])),[Value]))
var _table2=
ADDCOLUMNS(
    _table1,"YTD_Value",
IF(
    YEAR([Year_Month])=2024,
    SUMX(
        FILTER(_table1,[mindate]>=DATE(YEAR([mindate])-1,11,1)&&[mindate]<=DATE(YEAR([mindate]),11,1)&&[mindate]<=EARLIER([mindate])),[Sum_Value]),
    SUMX(
        FILTER(_table1,[mindate]>=DATE(YEAR([mindate]),1,1)&&[mindate]<=DATE(YEAR([mindate]),10,31)&&[mindate]<=EARLIER([mindate])),[Sum_Value])))
RETURN
SUMX(
    FILTER(_table2,[Year_Month]=MAX('Table'[Year_Month])),[YTD_Value])

As far as I know, Power BI default sorting is alphabetical, so [Year_Month] won't follow the table order to achieve that, we need to create a table to be used as sort_table to sort.

vyangliumsft_1-1730966468665.png

2. Create calculated table.

Sort_Table =
SUMMARIZE(
    'Table',[Year_Month],"mindate",MINX(FILTER(ALL('Table'),[Year_Month]=EARLIER('Table'[Year_Month])),[Date]))

vyangliumsft_2-1730966505771.png

3. Select [Year_Month] – Column tools – Sort by column – [mindate].

vyangliumsft_3-1730966505774.png

4. Joins the relationship between two tables.

vyangliumsft_4-1730966531525.png

5. Result:

vyangliumsft_5-1730966531533.png

 

Best Regards,

Liu Yang

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

marcelsmaglhaes
Super User
Super User

Hey @ljx0648 ,

You’ll need to check if the current fiscal year is 2024. If it is, you calculate the FYTD up to November 1, 2024; otherwise, you use the standard FYTD calculation ending on October 31.


FYTD_Sales_Special =
IF (
MAX(Datetable[Fiscal Year]) = 2024,
CALCULATE(
SUM(Salestable[Sales]),
DATESBETWEEN(Datetable[Date], DATE(2023, 11, 1), DATE(2024, 11, 1))
),
CALCULATE(
SUM(Salestable[Sales]),
DATESYTD(Datetable[Date], "31/10")
)
)


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Thank you so much for your suggestion Marcel.

 

I tried the formula you suggested and got the result below:

 

Year_MonthValueYTD Value
Jun-2311
Jul-2312
Aug-2313
Sep-2314
Oct-2315
Nov-2311
Dec-2311
Jan-2411
Feb-2411
Mar-2411
Apr-2411
May-2411
Jun-2411
Jul-2411
Aug-2411
Sep-2411
Oct-2411
Nov-2411

 

As you can see, the year_month before Nov 2023 really did add up as FYTD Value. However, the month after that doesnt add up.

 

May I know if you can offer any tips to modify it?

 

Much appreciated

 

Hey @ljx0648 ,

Maybe you can try this updated dax:

FYTD_Sales_Special =
IF (
MAX(Datetable[Fiscal Year]) = 2024,
CALCULATE(
SUM(Salestable[Sales]),
DATESBETWEEN(
Datetable[Date],
DATE(2023, 11, 1),
DATE(2024, 11, 1)
)
),
CALCULATE(
SUM(Salestable[Sales]),
DATESYTD(Datetable[Date], "31/10")
)
)


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



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.

Users online (4,250)