Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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