Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
qv_testing
Specialist II
Specialist II

Date Functions

Hi All,

This is my Calendar....

I want to create one field WeekNumber (start should be 1,2,3,4,5,6)

Let vMinDate=Num(MakeDate(2015,01,01));

Let vMaxDate=Num(MonthEnd(Today()));

Load

              $(vMinDate) AS Date,

              week($(vMinDate)) As Week,

              Year($(vMinDate)) As Year,

              Month($(vMinDate)) As Month,

              Day($(vMinDate)) As Day,            

                Week(weekstart($(vMinDate))) & '-' & WeekYear($(vMinDate)) as WeekYear,

              WeekDay($(vMinDate)) as WeekDay    

Autogenerate (1)

While ($(vMinDate)+IterNo())<$(vMaxDate);


Actually i have created weeknumber, but year=2016 and Month=Feb.. it showing starts from 2,3,4,5,6

But my requirement.. it should be 1, 2,3, 4, 5


Whatever if i am click any month it should start from 1,2,3,4,5,6


Thanks in Advance.....

11 Replies
sunny_talwar

Seems like a dynamic functionality you are looking for on the front end of the application. If that's true then there is nothing in the script you can do which would help you with this requirement. You will need to figure out a way to do it on the front end of the application.

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

For your week Number why not try

Num(week($(vMinDate)))  As WeekNumber,

qv_testing
Specialist II
Specialist II
Author

Yes, i want show front end.

Back end also not a problem.

If i am click 2016 and Feb..... I want show WeekNumber starting with 1....so on

sunny_talwar

Do you have a sample you can share?

qv_testing
Specialist II
Specialist II
Author

General Calendar 2005 to 2016

Please copy this code......

Let vMinDate=Num(MakeDate(2015,01,01));

Let vMaxDate=Num(MonthEnd(Today()));

Load      Date($(vMinDate)) AS Date,

              week($(vMinDate)+IterNo()) As Week,

              Year($(vMinDate)+IterNo()) As Year,

              Month($(vMinDate)+IterNo()) As Month,

              Day($(vMinDate)+IterNo()) As Day

AutoGenerate 1 while $(vMinDate)+IterNo()<$(vMaxDate);

 

Thanks....

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi

Try

Num(WeekDay($(vMinDate)+IterNo()))  AS WeekNumber.

This will start from zero (0)

bohravanraj
Partner - Creator II
Partner - Creator II

Please Refer Attach Qvw.

i hope it will solve your Purpose

Regards.

Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II

Hello Qv_Testing

Please, read this links

Redefining the Week Start

Redefining the Week Numbers

Hope it helps you

Joaquín

qv_testing
Specialist II
Specialist II
Author

HI Vanaraj,

This is perfect all right..

My Application very huge. It's taking much reloading time...

is there any way to implement Script level.....??