Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
srikantj
Creator
Creator

calendar date

Hi qlikss,

Need some expalanation

i have calendar script:

LOAD

       min(datefield) as DateMin

       ,max(datefield) as DateMax

;

LOAD

       FieldValue('date', RecNo()) as datefield

AutoGenerate FieldValueCount('date');

to find max and     min values of date, we can directly use max,min functions.why we need last 2 lines in calendar script.

I mean  these 2 lines

LOAD

       FieldValue('date', RecNo()) as datefield

AutoGenerate FieldValueCount('date');

18 Replies
srikantj
Creator
Creator
Author

Yes. you are right. Is there any special purpose to create table with all dates rather than just using your option

srikantj
Creator
Creator
Author

i mean your first option

avkeep01
Partner - Specialist
Partner - Specialist

You could skip the 2 lines if you direct pull data from the table with the field 'date'.

LOAD
date(DateMin + IterNo()) as [date]        
WHILE DateMin + IterNo() <= DateMax     
;

LOAD
min(datefield)-1 as DateMin
,
max(datefield) as DateMax
RESIDENT [Your table name];

avkeep01
Partner - Specialist
Partner - Specialist

Nope, I don't think so. If there is a reason then it is performance wise. Maybe on large dataset MIN / MAX on the resident table is slower the just creating a list of all dates that exists in your source table. In that case you only have one field in your table instead of all the other fields. Less columns are faster than a lot of columns. And only loading unique values creater lesser rows and lesser rows are faster then a lot of rows.

If you're working with a small dataset don't worry. If you have a large dataset. Try both ways and check the time needed for the reload.

srikantj
Creator
Creator
Author

I have one more doubt. If i reloaded qvw with just these 2 lines

LOAD

       FieldValue('date', RecNo()) as datefield

AutoGenerate FieldValueCount('date');

I got result like this.

Capture.PNG

why datefield has all ? marks instead of dataset

avkeep01
Partner - Specialist
Partner - Specialist

I suggest you should check the formatting of the field: [datefield]. Maybe the format isn't correct and it shows a ?. You could also check the table viewer. there you can see the values just as they are (without any format).

srikantj
Creator
Creator
Author

Yes, you are right. Got it thank you.

srikantj
Creator
Creator
Author

Yes formatting is not right. Thank you

Thanks for your patience and detailed explanation

A.M. van Keep

avkeep01
Partner - Specialist
Partner - Specialist

No Problem. You're welcome.