Forum Discussion
undefined
- 1 year ago
Hello Diksha,
Thank you for reaching out to the Microsoft Fabric Community.I have reproduced your scenario in Power BI Desktop using your custom Date table DAX script and was able to achieve the expected output as per your requirement that is, having the calendar start from Monday, 30-Dec-2024 instead of 1-Jan-2025.
The root cause was that the CALENDAR() function originally started from DATE(_fromYear,1,1) which excludes dates before 1-Jan. To address this, I modified the start date logic as follows:
var _calendarStart = DATE(_fromYear,1,1) - WEEKDAY(DATE(_fromYear,1,1), 2) + 1This shifts the calendar to begin on the Monday of the week containing 1-Jan, which in this case is 30-Dec-2024.
For your reference, I’m attaching the .pbix file that includes this working solution along with a table visual showing the calendar structure.
Thank you, Demert for sharing valuable insights.
If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you. - 1 year ago
Hi Diksha,
Thank you for your follow-up.You're right while the weeks now align with your corporate calendar, the default quarter logic in the date table still follows the calendar year format.
To meet your requirement, add a custom Corporate Quarter column to the Date_Master table using your quarter definitions.
Here's the Example DAX:
Corporate Quarter = SWITCH( TRUE(), [Date] >= DATE(2024,12,30) && [Date] <= DATE(2025,3,28), "Q1", [Date] >= DATE(2025,3,31) && [Date] <= DATE(2025,6,27), "Q2", [Date] >= DATE(2025,6,30) && [Date] <= DATE(2025,9,26), "Q3", [Date] >= DATE(2025,9,29) && [Date] <= DATE(2025,12,26), "Q4", "Out of Range" )This checks that your visuals reflect corporate fiscal quarters, not calendar quarters. You can now use the Corporate Quarter field instead of the default Quarter or Year Quarter Name columns.
I trust this information proves useful. If it does, kindly “Accept as solution” and give it a "kudos" to help others locate it easily.
Thank you.
Hello Diksha,
Thank you for reaching out to the Microsoft Fabric Community.
I have reproduced your scenario in Power BI Desktop using your custom Date table DAX script and was able to achieve the expected output as per your requirement that is, having the calendar start from Monday, 30-Dec-2024 instead of 1-Jan-2025.
The root cause was that the CALENDAR() function originally started from DATE(_fromYear,1,1) which excludes dates before 1-Jan. To address this, I modified the start date logic as follows:
var _calendarStart = DATE(_fromYear,1,1) - WEEKDAY(DATE(_fromYear,1,1), 2) + 1
This shifts the calendar to begin on the Monday of the week containing 1-Jan, which in this case is 30-Dec-2024.
For your reference, I’m attaching the .pbix file that includes this working solution along with a table visual showing the calendar structure.
Thank you, Demert for sharing valuable insights.
If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.
Thanks. Its works well with weeks. But when I am taking quarter. For Q1 I want it to start from again 30 Dec, 2024 to 28th March, 2025. But is it taking same 1 Jan to 31 March. Any suggestions on this.
- v-ssriganesh1 year ago
Community Support
Hi Diksha,
Thank you for your follow-up.You're right while the weeks now align with your corporate calendar, the default quarter logic in the date table still follows the calendar year format.
To meet your requirement, add a custom Corporate Quarter column to the Date_Master table using your quarter definitions.
Here's the Example DAX:
Corporate Quarter = SWITCH( TRUE(), [Date] >= DATE(2024,12,30) && [Date] <= DATE(2025,3,28), "Q1", [Date] >= DATE(2025,3,31) && [Date] <= DATE(2025,6,27), "Q2", [Date] >= DATE(2025,6,30) && [Date] <= DATE(2025,9,26), "Q3", [Date] >= DATE(2025,9,29) && [Date] <= DATE(2025,12,26), "Q4", "Out of Range" )This checks that your visuals reflect corporate fiscal quarters, not calendar quarters. You can now use the Corporate Quarter field instead of the default Quarter or Year Quarter Name columns.
I trust this information proves useful. If it does, kindly “Accept as solution” and give it a "kudos" to help others locate it easily.
Thank you.- v-ssriganesh1 year ago
Community Support
Hello Diksha,
I hope the information provided has been useful. Please let me know if you need further clarification or would like to continue the discussion.
If your question has been answered, please “Accept as Solution” and Give “Kudos” so others with similar issues can easily find the resolution.
Thank you.