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
SUMESHKUMAR22
Helper IV
Helper IV

Create date table to get Week Number and Quarter number


Hi Community, 

Requirement:
Im actually stuck in calculating Weeknumber & QuarterNumber. Based on the min & max date in the Aria(Table) date column it should consider the week 1 start from min date & when next year comes up it should continue rather than re-start from 1st week? E.g. 25 july is minmum date then 1 week & 3 jan 2024 is max date then 23rd week. 
1. Below is the Calculated date table. The WeekNumber should not restart from Jan-01-2024 instead it should continue from the last calculation as week-23. How?
2. How to calculate QuarterNumber by considering the same min & max date method ? The quarter should start with Q1 instead of Q3 for minimum date & so on calculate till max date.
Screenshot 2024-01-08 131045.png
Screenshot 2024-01-08 13125118.png
Pbix File Link

Time_Period =
VAR _StartDate =
MIN ( 'ARIA'[EVENT_DAY] )
VAR _EndDate =
MAX ( 'ARIA'[EVENT_DAY] )
VAR _WeekStart =
WEEKNUM ( _StartDate )
RETURN
ADDCOLUMNS (
CALENDAR ( _StartDate, _EndDate ),
"Year", YEAR ( [Date] ),
"Month", FORMAT ( [Date], "mmmm" ),
"MonthNum", MONTH ( [Date] ),
"Quarter", ( "Q" & FORMAT ( [Date], "Q" ) ),
"DayOfWeekName", FORMAT ( [Date], "dddd" ),
"WeekNumber",
IF (
[Date] >= DATE ( YEAR ( [Date] ), 8, 1 ),
QUOTIENT ( [Date] - DATE ( YEAR ( [Date] ), 8, 1 ), 7 ) + 2,
1
)
)


Thanks in advance!

1 REPLY 1
lbendlin
Super User
Super User

Consider using an external Calendar table instead, for example an Excel file on a SharePoint.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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