March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
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 !
Solved! Go to Solution.
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]))
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.
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]))
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.
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 !!!
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?
Proud to be a Super User! | |
If you have dates available in your calendar table then you will have an option for next year
Proud to be a Super User! | |
Hi
Try this out
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
)
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()
)
Proud to be a Super User! | |
Thanks for your response !
I am not getting the required output for year and Month is also not working as expected
It is showing only Feb month more over I should get as 2024 not 2023.
Thanks !
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
146 | |
97 | |
79 | |
69 |