Forum Discussion
How to calculate week number based on changing start dates?
- Anonymous2 years ago
Hi SRJPBI
For your question, here is the method I provided:
Here's some dummy data
"Table"
Create a column. First check the date to see what day of the week it is. Determine if it's the first day of a new offer or if it's a Saturday.
offer_week = var min_date = CALCULATE( MIN('Table'[date]), FILTER( 'Table', 'Table'[offer] = EARLIER('Table'[offer]) ) ) RETURN IF( 'Table'[date] = min_date || WEEKDAY('Table'[date], 2) = 6, 1, 2 )Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi SRJPBI
For your question, here is the method I provided:
Here's some dummy data
"Table"
Create a column. First check the date to see what day of the week it is. Determine if it's the first day of a new offer or if it's a Saturday.
offer_week =
var min_date =
CALCULATE(
MIN('Table'[date]),
FILTER(
'Table',
'Table'[offer] = EARLIER('Table'[offer])
)
)
RETURN
IF(
'Table'[date] = min_date
||
WEEKDAY('Table'[date], 2) = 6,
1,
2
)
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.