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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
rp2022
Helper II
Helper II

Calendar/Date help

I need help with a specific ask. 

rp2022_1-1737083590104.png

Need to calculate New Week and Reporting Date columns.

Appreciate any help

sample data:

DateDOWValueActual WeekNew Week ofReporting date
9/26/2024Thu200449/26/2024
9/27/2024Fri5004110/1/2024
9/28/2024Sat6004110/1/2024
9/30/2024Sun2005110/1/2024
10/1/2024Mon1001110/1/2024
10/2/2024Tue2001110/1/2024
10/26/2024Sat3003610/26/2024
10/27/2024Sun4003111/1/2024
10/28/2024Mon8004111/1/2024
10/29/2024Tue9004111/1/2024
10/30/2024Wed7004111/1/2024
11/2/2024Sat2001211/2/2024
11/4/2024Mon1002211/4/2024

 

6 REPLIES 6
Anonymous
Not applicable

Hi @rp2022 ,

 

Thanks for reaching out.

I almost understand your requirement, but I still have doubts about your last two rows.

vstephenmsft_2-1737339900797.png

How does the New Week and Reporting Date calculate? 

Why did the New Week change from 1 to 2 and the Reporting Date from 11/1/2024 to 11/2/2024 and 11/4/2024?

 

Best Regards,
Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Because the week is from Saturday to Friday

rp2022_0-1737385730180.png

 

rohit1991
Super User
Super User

To calculate New Week and Reporting Date in Power BI:

New Week = 
VAR CurrentDate = 'Table'[Date]
VAR DayOfWeek = WEEKDAY(CurrentDate, 1) -- 1 = Sunday
VAR Is27thFriday = (DAY(CurrentDate) = 27 && DayOfWeek = 6)
VAR Is26thSaturday = (DAY(CurrentDate) = 26 && DayOfWeek = 7)
RETURN
SWITCH(
    TRUE(),
    Is27thFriday, 1,
    Is26thSaturday, MAXX(FILTER('Table', MONTH('Table'[Date]) = MONTH(CurrentDate)), 'Table'[Actual Week]) + 1,
    WEEKNUM(CurrentDate) - WEEKNUM(DATE(YEAR(CurrentDate), MONTH(CurrentDate), 1)) + 1
)

 

Reporting Date (DAX):

Reporting Date = 
IF(WEEKDAY('Table'[Date], 1) IN {6, 7}, 'Table'[Date], DATE(YEAR('Table'[Date]), MONTH('Table'[Date]) + 1, 1))

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

thank you for your reply. The problem with your solution is that when we have an extra week 1 into the next month (coming from Previous month for whatever reason), the actual week 1 of that month should move to week 2, and week 2 should be week 3 and so on. that doesnt happen. For eg: 9/27 is a friday, so it becomes Week 1 for month 10. then 10/4 which is actually week 1 should become week 2

rp2022_0-1737122890772.png

 

rajendraongole1
Super User
Super User

Hi @rp2022  - create below calculated column for new week:

New Week =
VAR CurrentDate = 'Table'[Date]
VAR DayOfWeek = WEEKDAY(CurrentDate, 1) -- 1 = Sunday, 7 = Saturday
VAR Is27th = DAY(CurrentDate) = 27 && DayOfWeek = 6 -- 27th is a Friday
VAR Is26th = DAY(CurrentDate) = 26 && DayOfWeek = 7 -- 26th is a Saturday
VAR StartOfWeek =
IF(
Is27th,
DATE(YEAR(CurrentDate), MONTH(CurrentDate) + 1, 1),
CurrentDate - MOD(DayOfWeek + 1, 7) -- Back to Saturday
)
VAR WeekNumber =
RANKX(
FILTER('Table', YEAR([Date]) = YEAR(CurrentDate) && MONTH([Date]) = MONTH(CurrentDate)),
StartOfWeek,
, ASC
)
RETURN
IF(Is27th || Is26th, WeekNumber, WeekNumber)

 

another columne for reporting date

Reporting Date =
VAR CurrentDate = 'Table'[Date]
VAR DayOfWeek = WEEKDAY(CurrentDate, 1) -- 1 = Sunday, 7 = Saturday
VAR StartOfWeek =
CurrentDate - MOD(DayOfWeek + 1, 7) -- Back to Saturday
RETURN
StartOfWeek

 

Hope this works. please check





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

Proud to be a Super User!





Thanks for the reply. But, this doesnt work

rp2022_0-1737136242312.png

 

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.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors