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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
ctedesco3307
Resolver II
Resolver II

Weekly Date Calculation

In the calendar table structure below the Billing Friday column is meant to identify the friday of that week the Date falls on, for billing cycle purposes....

 

What I need it to do is choose the prior friday for the saturday dates, but the following friday for all others. So in short, include saturday in the current bill week


How do I fix the return for that? In this current formula, for example, 1/2/2021 returns 1/8/2021 and it should return 1/1/2021

Thanks very much in advance

------------------------------------------------------------------------------------------------------------

TTDate = ADDCOLUMNS(
CALENDAR(date(2021,1,1), date(2022,12,31)),
"Month", FORMAT([Date],"mmm YY"),
"Year",YEAR([Date]),
"Week", WEEKNUM([Date]),
"WeekDay", WEEKDAY ( [Date], 1 ),
"Billing Friday",
VAR DayNumber =
WEEKDAY ( [Date], 1 )
RETURN
[Date] + ( 6 - DayNumber ) + 7 * ( DayNumber > 6 )
 
)
1 ACCEPTED SOLUTION
freginier
Super User
Super User

Try this and tell me

TTDate = ADDCOLUMNS(
CALENDAR(date(2021,1,1), date(2022,12,31)),
"Month", FORMAT([Date],"mmm YY"),
"Year",YEAR([Date]),
"Week", WEEKNUM([Date]),
"WeekDay", WEEKDAY ( [Date], 1 ),
"Billing Friday",
VAR DayNumber =
WEEKDAY ( [Date], 1 )
RETURN
IF(DayNumber = 7,[Date] - 1, [Date] + 6 - DayNumber)
)

 

View solution in original post

2 REPLIES 2
ctedesco3307
Resolver II
Resolver II

@freginier - This was perfect! Thank you 

freginier
Super User
Super User

Try this and tell me

TTDate = ADDCOLUMNS(
CALENDAR(date(2021,1,1), date(2022,12,31)),
"Month", FORMAT([Date],"mmm YY"),
"Year",YEAR([Date]),
"Week", WEEKNUM([Date]),
"WeekDay", WEEKDAY ( [Date], 1 ),
"Billing Friday",
VAR DayNumber =
WEEKDAY ( [Date], 1 )
RETURN
IF(DayNumber = 7,[Date] - 1, [Date] + 6 - DayNumber)
)

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.