cancel
Showing results for 
Search instead for 
Did you mean: 

How to find if a date column is sunday or not?

0 Kudos

Use LOAD_D(date column) if this is a Sunday; Otherwise, convert to Sunday’s date; Please note that the most likely day, other than Sunday, is Saturday, in which case simply add 1 to the date.

Experts-How to implement this in bods?

Accepted Solutions (1)

Accepted Solutions (1)

former_member187605
Active Contributor
0 Kudos

dateColumn - day_in_week(dateColumn) + 7 always returns (next) Sunday's date

0 Kudos

Hi Dirk,

Any specific logic just to find if a date is sunday or not?

0 Kudos

As per the logic you have provided it is always returning next sunday's date.

What logic we have to apply if we have to get previous sunday's date?

former_member187605
Active Contributor

dateColumn - day_in_week(dateColumn)

0 Kudos

Hi Dirk,

We are joining 6 tables using inner join and we're getting around 30 million records in output.

Can you suggest some valuable performance optimization techniques?

Answers (2)

Answers (2)

0 Kudos

Hi Dirk,

USE LOAD_D if this is a Sunday; Otherwise, convert to Sunday’s date. For Monday to Wednesday, use the previous Sunday; For Thursday to Saturday, use the following Sunday.

How to implement this in BODS?

former_member187605
Active Contributor
0 Kudos

isweekend(dateColumn) = 1 and isweekend(dateColumn + 1) =0