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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
rsbin
Community Champion
Community Champion

Bi-Weekly Calendar

Good Afternoon,

Haven't been able to come up with a solution to this one.  Have a Calendar Table and need to add a Calculated Column to get  a Bi-Weekly Payroll Date that starts on Monday.

Date StartDate_Mon
12/25/2023 12/25/2023
12/26/2023 12/25/2023
12/27/2023 12/25/2023
12/28/2023 12/25/2023
12/29/2023 12/25/2023
12/30/2023 12/25/2023
12/31/2023 12/25/2023
1/1/2024 12/25/2023
1/2/2024 12/25/2023
1/3/2024 12/25/2023
1/4/2024 12/25/2023
1/5/2024 12/25/2023
1/6/2024 12/25/2023
1/7/2024 12/25/2023
1/8/2024 1/8/2024
1/9/2024 1/8/2024
1/10/2024 1/8/2024
1/11/2024 1/8/2024
1/12/2024 1/8/2024
1/13/2024 1/8/2024
1/14/2024 1/8/2024
1/15/2024 1/8/2024
1/16/2024 1/8/2024
1/17/2024 1/8/2024
1/18/2024 1/8/2024
1/19/2024 1/8/2024
1/20/2024 1/8/2024
1/21/2024 1/8/2024
1/22/2024

1/22/2024

Kind Regards,

1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

try this code, it assigns the dates correctly for 2022-2025, could probably be derived from nr of days in the first/last week of the year

Payroll Date =
VAR _year_end_offset_map = { ( 2022, 1 ), ( 2023, 1 ), ( 2024, 0 ) }
VAR _year_end_offset =
    MAXX (
        FILTER ( _year_end_offset_map, [Value1] = YEAR ( 'Calendar'[Date] ) ),
        [Value2]
    )
VAR _week_nr =
    WEEKNUM ( 'Calendar'[Date], 2 ) + _year_end_offset
VAR _week_day =
    WEEKDAY ( 'Calendar'[Date], 3 )
VAR _day_offset =
    _week_day
        + ISODD ( _week_nr ) * 7
RETURN
    'Calendar'[Date] - _day_offset

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

2 REPLIES 2
Stachu
Community Champion
Community Champion

try this code, it assigns the dates correctly for 2022-2025, could probably be derived from nr of days in the first/last week of the year

Payroll Date =
VAR _year_end_offset_map = { ( 2022, 1 ), ( 2023, 1 ), ( 2024, 0 ) }
VAR _year_end_offset =
    MAXX (
        FILTER ( _year_end_offset_map, [Value1] = YEAR ( 'Calendar'[Date] ) ),
        [Value2]
    )
VAR _week_nr =
    WEEKNUM ( 'Calendar'[Date], 2 ) + _year_end_offset
VAR _week_day =
    WEEKDAY ( 'Calendar'[Date], 3 )
VAR _day_offset =
    _week_day
        + ISODD ( _week_nr ) * 7
RETURN
    'Calendar'[Date] - _day_offset

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

rsbin
Community Champion
Community Champion

@Stachu ,

Awesome!!
Now to study it in more detail to figure out how it works.
Thank you so much for the solution!!!

Kindest Regards,

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.