Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with date variable in set analysis.

Hello, everyone.

The following (hardcoded) set analysis works as intended:

=SUM({ $ < Date = {'<=12/01/2017'} >} Amount )

But indeed what I wanna do, is let the user select the date. And so did I. I created a calendar, and assigned a variable.

Calendar.JPG

VARIABLE.JPG

But when I rewrite the set analysis, in order to include this variable

=SUM({ $ < Date = {'<=$(vFechaHastaLM)} >} Amount )

It just doesn't work. While I should get the same values as in the first set analysis. I actually don't get any value.

Does anyone have any idea of what might be happening?

Thanks!

19 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Most likely when you put the variable, the content of the variable isn't exactly as the hardcoded '12/01/2017' and in that case the set analysis won't find the equivalent date.

Felipe.

Anonymous
Not applicable
Author

Hi there,

try this: =SUM({$<Date={'<=$(vFechaHastaLM)'}>}Amount)


Thanks

trdandamudi
Master II
Master II

It looks like you are missing the closing quote:

=SUM({ $ < Date = {'<=$(vFechaHastaLM)'} >} Amount )

Not applicable
Author

Yes indeed, Thirumala, you are right, but only on my post (was just a typo). I actually have it well written on my dashboard, and it does not work : S . Thanks anyway!

Not applicable
Author

Hi, Matthew. That's the very same set analysis, but with the missing closing quote. I wrote it OK on my dashboard, but I miswrote it on my post, sorry. Anyway, it does not work even with the closing quote. Thanks, anyway!

Anonymous
Not applicable
Author

I think I've found the solution, there should be no quotes!

SUM({$<Date={<=$(vFechaHastaLM)}>}Amount)

felipedl
Partner - Specialist III
Partner - Specialist III

See the output of your variable in a text box, to see if it matches your hardcoded date.

trdandamudi
Master II
Master II

Ok got it.. Make sure you set the format of the date in the calendar object like below:

Not applicable
Author

Hi, Felip. Thanks for your answer. I agree with your observation: the content of the variable is not '12/01/2017', indeed. It is in another format (in point of fact, it is '42747').

What strikes me the most, is that I have always done this comparisons (with the same database format) and I've never run into this problem.

Anyway, I tried declaring a variable DATE($(vFechaHastaLM)) which actually shows 12/01/2017, and I tried using it in the set analysis, in the very same way I used the other, but I had no luck.


Thanks anyway!