Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
hamzabob1
Partner - Contributor III
Partner - Contributor III

Fiscal week starting from Monday.

I am trying to start my week in fiscal calendar from Monday.It starts from Monday only for the current year but for the previous year it starts from Sunday.I want to start the week from Monday for all the years.

Below is the expression i've used:

Div(Date-YearStart(Date,0,4),7)+1 as Week,

Kindly help,

Regards,

Hamza

4 Replies
johnca
Specialist
Specialist

Why not set the first day of the week to Monday in the script where all the initial environment variables are set...

SET FirstWeekDay=7;

The default is 6 and equates to Sunday. 7 equates to Monday, etc...

HTH,

John

hamzabob1
Partner - Contributor III
Partner - Contributor III
Author

Hii John,

Thanks for your rpl,but still am facing the same issue..

hamza

Brett_Bleess
Former Employee
Former Employee

The following is in regard to fiscal year, but it may be of some help in getting you on the right track, it is a design blog post from Henric Cronstrom, hopefully it gets you a bit further on things.  There are a bunch of other posts out there as well, so I would be sure to search further if this one does not get you exactly what you need, as there may be another with the additional detail you need...

https://community.qlik.com/t5/Qlik-Design-Blog/Fiscal-Year/ba-p/1472103

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
johnca
Specialist
Specialist

Thanks for that link Brett. I ended up playing with that far too long, but was able to create something close. It needs some finagling to get it to work YoY but I did get it to set the start week to 1 on April 1st. Getting it to not count week 1 UNTIL Monday in the first week of the year is the next challenge. Otherwise it works okay.

/* Set date range for calendar */

LET vDateMin = Num(MakeDate(2015,4,1));
LET vDateMax = Floor(MonthEnd(Today()));
LET vDateToday = Num(Today());

TempCalendar:
LOAD
Date($(vDateMin) + RowNo() - 1) AS TempDate
AUTOGENERATE 1 WHILE $(vDateMin)+IterNo()-1<= $(vDateMax);

/* HC's code, modified for vFW and fWeek below; */

Set vFM = 4 ; // First month of fiscal year
Set vFW = 14 ; /* Added to get the First week of fiscal year, as close to April 1st as possible */

Calendar:
Load TempDate as Date,   /* date to join to other data */
WeekDay,     /* To verify day of week when week starts */
Year + If(Month>=$(vFM), 1, 0) as fYear, // Numeric fiscal year
Mod(Month-$(vFM), 12)+1 as fMonth, // Numeric fiscal month
Mod(Week-$(vFW), 52)+1 as fWeek /* Added for the week. Not perfect but can be modified to get what you need */
;
Load TempDate,
Year(TempDate) as Year, // Your standard master calendar
Month(TempDate) as Month,
Week(TempDate) as Week,
WeekDay(TempDate) as WeekDay
RESIDENT TempCalendar
ORDER BY TempDate ASC;

DROP TABLE TempCalendar;

 

Anyway, this should help Hamza...