Q:

snowflake: Dateadd only weekdays

is it possible to add only weekdays in a date function?
dateadd(day,10,business_date) ==> instead of returning next 10 days, is it possible to retirve next 10 weekdays ?
regards,
Sridar

A:

There are some semi complicated functions out there in other languages for this that could be converted, but without knowing more, I'd generally recommend the method of creating a calendar table.
In that table, you can label dates as weekdays and then join and filter with that table.
This also lets you extend to holidays with an additional IsHoliday flag
Then you can join to lists of dates with queries like this
SELECT DateColumnValue, RANK() OVER(ORDER BY DATEKEY) RNK 
FROM DIMDATE
WHERE DateColumnValue >= CURRENT_DATE
    AND isWeekday = 1
    AND isHoliday = 0
QUALIFY RNK <= 10

