Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I'm use a QVD with some financial statistics and they are all based on weekNo.
I've just noted that the function WeekNo of the date 31/12/2015 returns 53 instead of 1! Reading the following article (Redefining the Week Numbers)I think I have to change something in my master calendar but really unable to understand the correct way.
Could someone help me with this?
Thank you
What is the rule in your calendar system that defines when to start week 1?
(There are different rules possible, that's why I am asking)
Hi,
Many thanks for your reply.
I think this is my problem.
I don't have rules and don't know of use them.
I just load the date and use the function week and weeknane.
Massimo Paribelli
IT Manager
mparibelli@augustea.com<mailto:mparibelli@augustea.com>
it@augustea.com<mailto:it@augustea,.com>
Augustea Holding Spa
Viale Gramsci, 5 80122 Napoli Italy<x-apple-data-detectors://3/0>
Phone 39 081 5980968<tel:39%20081%205980968>
Fax 39 081 2486226<tel:39%20081%202486226>
mobile 39 335 272187<tel:39%20335%20272187>
www.augustea.com<http://www.augustea.com/>
Il giorno 28 gen 2016, alle ore 19:53, swuehl <qcwebmaster@qlikview.com<mailto:qcwebmaster@qlikview.com>> ha scritto:
Qlik Community <https://community.qlik.com/?et=watches.email.thread>
Wrongly weekNo for my dates
risposta da swuehl<https://community.qlik.com/people/swuehl?et=watches.email.thread> su New to QlikView - Visualizza la discussione completa<https://community.qlik.com/message/962940?et=watches.email.thread#962940>
Then maybe you need to ask someone around which rules are applying to financial calendar you are using.
Using Henric's script you should be able to implement most scenarios, using the parameter
Set vCal_FD = 0; // First Day of the week {0=Mon, 1=Tue, ... , 6=Sun}
Set vCal_BW = 0; // Broken Weeks allowed {0=No, 1=Yes}
Set vCal_RD = 4; // Reference day = This day in Jan defines week one {1..7}
Hi Swehl,
many thanks for your reply.
I undertand how use the Set suggested and added in my script but unable to understand how use it.
For example once done the Set for the loading and I have a field named DATE_REF that contains my dates. How is the syntax in roder to tell to my load that when I use Weekname(DATE_REF) for the date *31/12/2015' it should return 2015\52 instead of 2015/53?
Thank you
Well, there is more code you need to copy to your script in Henric's blog post:
"
If you copy the above parameters to your QlikView script and the following lines to your Master Calendar definition, you can redefine the week numbers any way you want:
Load *,
Div( Date - WeekStart( WeekYearRefDate, 0, $(vCal_FD) ) + 7, 7 ) as WeekNumber,
Year( WeekYearRefDate ) as WeekYear;
Load *,
Date( YearStart( If( $(vCal_BW), Date, WeekRefDate )) + $(vCal_RD) - 1) as WeekYearRefDate ;
Load *,
Date( WeekStart( Date, 1, $(vCal_FD) ) - $(vCal_RD) ) as WeekRefDate ;
"
Thank you,
but my real question is: I never used a Master Calendar in Qlik View and donìt know how to put the suggested sintax in it. Could you help?
Thank you