Skip to main content

Hi Team,

We are currently trying to use round_week() function as a dimension. However, I see the function would aggregate the week values starting from Monday to Sunday as a week.

Is there a possibility where I can represent the week to start from Saturday and end on Friday and aggregate the weekly values as per the same?

Thanks in Advance

Soham Potdar

Hi Soham Potdar,

I think you could just simply add two days to every date before rounding it to the week and then subtract two days from the rounded date to get the proper start date of the week:

ADD_DAYS(ROUND_WEEK(ADD_DAYS(column, 2)), -2)

This maps e.g. a Sat, 5 Sep to Mon, 7 Sep, rounds to week 2020-09-07 and after subracting 2 days, returns 2020-09-05 as week again.

Best

Max


Hi Max,
Thank you for the reply. It worked like a charm
Regards,
Soham Potdar

Reply