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
raassd
Helper I
Helper I

Fiscal Calendar Month Calculation

Team,

I am creating a Fiscal Cal Table where in Start date is from 04/02/2024 to 01/02/2024 for CY and next year it starsts from 02/02/2025 and goes on.  attaching the screen shot for the same.

I need to create a year coulmn and Month Column if I select 2024 it should show from Feb 4 to Jan 1st 2025 and for Month If I select Feb it should show dates from 4th Jan to 2nd Feb, If I select Jun it should show all the values from 2nd Jun to 6th July as shown in the below image. 

 

Please help me thanks in Advance !

 

 

 

1 ACCEPTED SOLUTION
v-kaiyue-msft
Community Support
Community Support

Hi @raassd ,

 

You can create a calculated table.

Table = 
VAR _vtable1 =
    ADDCOLUMNS (
        CALENDAR ( "2024-1-1", "2025-2-28" ),
        "_Rank",
            RANKX (
                FILTER (
                    CALENDAR ( "2024-1-1", "2025-2-1" ),
                    MOD ( DATEDIFF ( "2024-2-3", [Date], DAY ), 7 ) = 0
                ),
                [Date],
                ,
                ASC
            )
    )
RETURN
    SELECTCOLUMNS (
        ADDCOLUMNS (
            _vtable1,
            "month",
                FORMAT (
                    MINX ( FILTER ( _vtable1, [_Rank] = EARLIER ( [_Rank] ) ), [Date] ),
                    "mmmm"
                )
        ),
        [Date],
        [month]
    )

 

Then create a calculated column.

Year = 
IF([month] = "January",YEAR([Date]) - 1, YEAR([Date]))

 

vkaiyuemsft_0-1725607667582.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

7 REPLIES 7
v-kaiyue-msft
Community Support
Community Support

Hi @raassd ,

 

You can create a calculated table.

Table = 
VAR _vtable1 =
    ADDCOLUMNS (
        CALENDAR ( "2024-1-1", "2025-2-28" ),
        "_Rank",
            RANKX (
                FILTER (
                    CALENDAR ( "2024-1-1", "2025-2-1" ),
                    MOD ( DATEDIFF ( "2024-2-3", [Date], DAY ), 7 ) = 0
                ),
                [Date],
                ,
                ASC
            )
    )
RETURN
    SELECTCOLUMNS (
        ADDCOLUMNS (
            _vtable1,
            "month",
                FORMAT (
                    MINX ( FILTER ( _vtable1, [_Rank] = EARLIER ( [_Rank] ) ), [Date] ),
                    "mmmm"
                )
        ),
        [Date],
        [month]
    )

 

Then create a calculated column.

Year = 
IF([month] = "January",YEAR([Date]) - 1, YEAR([Date]))

 

vkaiyuemsft_0-1725607667582.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

@v-kaiyue-msft ,

 

Awsom !!! 

This is working as expected, Hope I can change my end date calendar as per the requirmnet and hope that will not change the calculations ?

 

Thank you soo much !!!

 

 

Kaviraj11
Super User
Super User

Hi,

 

With above code, i was able to produce the output as you would like. Please check you table or relationships. Could you share a sample file?

 

Kaviraj11_0-1725550366732.png

Kaviraj11_1-1725550424849.png

 

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@Kaviraj11 ,

 

How this will work for next year ?

 

Thnaks !

If you have dates available in your calendar table then you will have an option for next year




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Kaviraj11
Super User
Super User

Hi 

 

Try this out

Year Column

To create a Year column that reflects your custom fiscal year, you can use the following DAX formula:

FiscalYear = 
IF(
    MONTH([Date]) >= 2,
    YEAR([Date]),
    YEAR([Date]) - 1
)

Month Column

For the Month column, you need to account for the custom start and end dates within each month. Here’s a DAX formula to achieve this:

FiscalMonth = 
SWITCH(
    TRUE(),
    [Date] >= DATE(YEAR([Date]), 2, 4) && [Date] <= DATE(YEAR([Date]), 3, 1), "Feb",
    [Date] >= DATE(YEAR([Date]), 3, 2) && [Date] <= DATE(YEAR([Date]), 4, 1), "Mar",
    [Date] >= DATE(YEAR([Date]), 4, 2) && [Date] <= DATE(YEAR([Date]), 5, 1), "Apr",
    [Date] >= DATE(YEAR([Date]), 5, 2) && [Date] <= DATE(YEAR([Date]), 6, 1), "May",
    [Date] >= DATE(YEAR([Date]), 6, 2) && [Date] <= DATE(YEAR([Date]), 7, 1), "Jun",
    [Date] >= DATE(YEAR([Date]), 7, 2) && [Date] <= DATE(YEAR([Date]), 8, 1), "Jul",
    [Date] >= DATE(YEAR([Date]), 8, 2) && [Date] <= DATE(YEAR([Date]), 9, 1), "Aug",
    [Date] >= DATE(YEAR([Date]), 9, 2) && [Date] <= DATE(YEAR([Date]), 10, 1), "Sep",
    [Date] >= DATE(YEAR([Date]), 10, 2) && [Date] <= DATE(YEAR([Date]), 11, 1), "Oct",
    [Date] >= DATE(YEAR([Date]), 11, 2) && [Date] <= DATE(YEAR([Date]), 12, 1), "Nov",
    [Date] >= DATE(YEAR([Date]), 12, 2) && [Date] <= DATE(YEAR([Date]) + 1, 1, 1), "Dec",
    [Date] >= DATE(YEAR([Date]) + 1, 1, 2) && [Date] <= DATE(YEAR([Date]) + 1, 2, 3), "Jan",
    BLANK()
)



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@Kaviraj11 ,

 

Thanks for your response !

I am not getting the required output for year and Month is also not working as expected

raassd_0-1725548094951.pngraassd_1-1725548115814.png

It is showing only Feb month more over I should get as 2024 not 2023.

Thanks !

 

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.