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: 
rajtechnocraft
Creator
Creator

Help required to modify my start date and to Date in Calender Object

Hi Experts,

I have used the code to cretae my From Date and To Date Calender.

Attached is the code

It is working fine

I want little bit customisation to be done to it

My date data from the Date table is starting from 6th Jul 2009 where as in calender it will start from 1st

Can i default mu start date in my calender to 6th Jul 2009

And my to date should be greater than  my start date in my case it should be gretaer than 6th Jul 2009

How can i achieve this

Regards

arvind

16 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this script.

MaxMinDate:
Load
max(Date) as MaxOccurredDate,
min(Date) as MinOccurredDate
resident Incident;


Let vMaxOrderDate = num(peek('MaxOccurredDate',0,'MaxMinDate'));
Let vMinOrderDate = num(peek('MinOccurredDate',0,'MaxMinDate'));

Calendar:
Load
*,
Day(Start_Date) as SDay,
Month(Start_Date) as [SMonth],
Year(Start_Date) as [SYear]
;
Load Date($(vMinOrderDate ) + rowno() -1) as Date
Autogenerate 1
While Date($(vMinOrderDate ) + rowno() -1) < date($(vMaxOrderDate ))


Calendar2:
Load
*,
Day(Start_Date) as SDay,
Month(Start_Date) as [SMonth],
Year(Start_Date) as [SYear]
;
Load Date($(vMinOrderDate ) + rowno() -1) as Date
Autogenerate 1
While Date($(vMinOrderDate ) + rowno() -1) < date($(vMaxOrderDate ))

      

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
rajtechnocraft
Creator
Creator
Author

Hi Kaushik,

It is giving parameter error

attached is the screenshot

Regards

Raj

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     It is because the variables are null, they are unable to get the data from max table.

     Try this script

MaxMinDate:
Load distinct
max(Date) as MaxOccurredDate,
min(Date) as MinOccurredDate
resident Incident;


Let vMaxOrderDate = num(peek('MaxOccurredDate',0,'MaxMinDate'));
Let vMinOrderDate = num(peek('MinOccurredDate',0,'MaxMinDate'));

Calendar:
Load
*,
Day(Start_Date) as SDay,
Month(Start_Date) as [SMonth],
Year(Start_Date) as [SYear]
;
Load Date($(vMinOrderDate ) + rowno() -1) as Date
Autogenerate 1
While Date($(vMinOrderDate ) + rowno() -1) < date($(vMaxOrderDate ))


Calendar2:
Load
*,
Day(Start_Date) as SDay,
Month(Start_Date) as [SMonth],
Year(Start_Date) as [SYear]
;
Load Date($(vMinOrderDate ) + rowno() -1) as Date
Autogenerate 1
While Date($(vMinOrderDate ) + rowno() -1) < date($(vMaxOrderDate ))

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
rajtechnocraft
Creator
Creator
Author

Hi Kaushik,

Thanks for the reply

But i got error  same

Error in expression date Takes 1-2 parameters

Also i wanted to know in my original code

I used 2 calender scripts one i called as start Date  and the other i called as End Date

But in your script i found in both the calender code u kept as date only

How do i choose in UI calender object which one is to be used as from Date field and which one to use as To Date Field

I want that my start date  from calender object 1 should start from 6th Jul 2009

and my To Date in calender object should be gretaer than 6th July 2009

Thanks in advance

Regards

Raj

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Kindly post your qvw file with the backup data.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
rajtechnocraft
Creator
Creator
Author

Hi Kaushik,

Attached is the test qvw which is working fine between dates

From Date and To Date

Please help me with setting From date in calender default to 6th Jul 2009

and in From Date calender object i want the date greater than 6th Jul 2009

Regards

Raj

rajtechnocraft
Creator
Creator
Author

Sorry in above reply From Date should default to 6th Jul 2009

and To Date should be greater than 6th Jul 2009

rajtechnocraft
Creator
Creator
Author

Sorry in above reply From Date should default to 6th Jul 2009

and To Date should be greater than 6th Jul 2009

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     There is no data in the test file uploaded by you.

     Kindly check and upload the correct one with QVD or base data for Reload.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!