Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
olivierbuchy
Creator
Creator

Still more nightmare with dates

Can't seem to be able to use a date in a calculated dimension:

1) Load statement

date#(<Input String>,'DDMMYYYY') as ExportDate

2) Variables

SET lastExport = max({1} DateExport )

3) Calculated dimension in my chart

=if(DateExport=$(lastExport), Catégorie)

//This yields a msg "Error in calculated dimension"

=if(DateExport='$(lastExport)', Catégorie) //Notice the single quotes

//This yields no result (condition seems to be always wrong)

Help!

12 Replies
tresesco
MVP
MVP

Is this a typo?

SET lastExport = max({1} DateExport )

                            max({1} ExportDate )            // right one

Henric_Cronström

You cannot use set analysis in the script. And you cannot use an aggregation function in a Set or a Let statement.

HIC

olivierbuchy
Creator
Creator
Author

Yes Typo when I created the case here, but no typo in my code.

sasiparupudi1
Master III
Master III

load

date#(yourDateString,'DDMMYYYY') as ExportDate,

....

...

from your data source;

in the front end I assume you declared a variable

as lastExport = max({1} ExportDate)

in your calculated dimension

=if(ExportDate='$(lastExport)', Categorie)

=if(ExportDate=$(=lastExport), Categorie)

hth

Sasi

tresesco
MVP
MVP

Hi hic‌, he is probably just writing an expression (a mere string to hold in a variable) at the back-end which is to be used at the front-end.

tresesco
MVP
MVP

Well then try like:

=if(DateExport=$(=lastExport), Catégorie)

Note, an additional '=' sign before the variable name. This should work if there is SINGLE Catégorie against your max date.

olivierbuchy
Creator
Creator
Author

Sorry for the confusion, in my code there is no Typo, ExportDate everywhere, and with the results I described in my original post

sasiparupudi1
Master III
Master III

well then I would say to inspect the following

what is the value in the variable lastExport

and the value in the dimesion ExportDate


are they both in the same format?

olivierbuchy
Creator
Creator
Author

No doesn't work like this either, "Error in calculated dimension"