Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

hic
Former Employee
Former Employee

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

HIC

Anonymous
Not applicable
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.

Anonymous
Not applicable
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?

Anonymous
Not applicable
Author

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