Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

deborahlevin
New Contributor

Formula to calculate the week start date with Monday as beginning of week.

I have an [Audit Date] field. I would like to create a simple formula that will determine the week starting date (with Monday as the week starting date). for example, if the [Audit Date] = 03/21/2018, I would like the Week Start Date to show  03/19/2018.  If the Audit date was 02/09/2018, the week start date should be 02/05/208.

What is the best formula to use?

5 Replies
ychaitanya
Contributor III

Re: Formula to calculate the week start date with Monday as beginning of week.

Can you try re-setting the below setting in  Load Script Editor in QlikSense.

Default:

SET FirstWeekDay=6;

Change to SET FirstWeekDay=1;(i think 0 or 1 try)?


Thanks

CY

zebhashmi
Valued Contributor

Re: Formula to calculate the week start date with Monday as beginning of week.

you can use WeekStart(date [, period_no = 0 [, first_week_day=0]])

zebhashmi
Valued Contributor

Re: Formula to calculate the week start date with Monday as beginning of week.

weekstart('12/01/2013')Returns 07/01/2013.
weekstart('12/01/2013', -1 )Returns 31/11/2012.
weekstart('12/01/2013', 0, 1)Returns 08/01/2013.
deborahlevin
New Contributor

Re: Formula to calculate the week start date with Monday as beginning of week.

I am confused how this formula would take a date, such as 02/09/2018, and return a week start date of 02/05/2018.

zebhashmi
Valued Contributor

Re: Formula to calculate the week start date with Monday as beginning of week.

as it is it should return the 02/05/2018

huuu

ok try this

WeekStart('02/09/2018',0,0)

Community Browser