Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
hagemann
Contributor II
Contributor II

Variable in set Analysis

I have a variable "Vandaag" which is defined as 

 concat(Text(year(Now() )) & if(len(text( num(month( now()))))= 1,'0'&text( num(month( now()))) ,text( num(month( now())))) &if(len(text( num(day( now()))))= 1,'0'&text( num(day( now()))) ,text( num(day( now())))) )

and it results in a date like number 20190212    

I want to use it in this statement, which works if I just write the number: 

=Sum({$<Begindatum={"<20190212"}>}Werktijdfactor_Week) (Note that "Begindatum"  is a similar number) 

But when I use the Variable 

=Sum({$<Begindatum={"<$(Vandaag)"}>}Werktijdfactor_Week) or 

=Sum({$<Begindatum={"<$(=Vandaag)"}>}Werktijdfactor_Week) or 

=Sum({$<Begindatum={"<$(#Vandaag)"}>}Werktijdfactor_Week)

it doesn't work 
Does anyone have a suggestion?  

1 Solution

Accepted Solutions
uacg0009
Partner - Specialist
Partner - Specialist

Hi Hagemann,

Please try to use below expression, it works in my desktop sample:

=Sum({$<Begindatum={"<$(=$(Vandaag))"}>}Werktijdfactor_Week)

Thanks.

Aiolos Zhao

View solution in original post

6 Replies
pradosh_thakur
Master II
Master II

try this

 

=Sum({$<Begindatum={"<$(=$(Vandaag))"}>}Werktijdfactor_Week) 

if this doesn't work please put a equal to(=) in your variable defination and then simply use 

=Sum({$<Begindatum={"<$(Vandaag)"}>}Werktijdfactor_Week) 
Learning never stops.
uacg0009
Partner - Specialist
Partner - Specialist

Hi Hagemann,

Please try to use below expression, it works in my desktop sample:

=Sum({$<Begindatum={"<$(=$(Vandaag))"}>}Werktijdfactor_Week)

Thanks.

Aiolos Zhao

hagemann
Contributor II
Contributor II
Author

The first option gives a result, but if i Change LT in GT then the result does not change while it should.
Thx though!
hagemann
Contributor II
Contributor II
Author

Thank you: it works perfect. I cannot understand why. Is there a document that could teach me this?

Kind regards,
Hans Hagemann
marcus_sommer

I think your problem is caused from the number-string which you have created in the variable and which could be easier created with something like:

Vandaag:
= num#(date(today(), 'YYYYMMDD'), '######')

and then you might use:

Sum({$<Begindatum={"<$(Vandaag)"}>}Werktijdfactor_Week)

or if there is no further use for the variable you could use the logic directly within the set analysis like:

Sum({$<Begindatum={"<$(=num#(date(today(), 'YYYYMMDD'), '######'))"}>}Werktijdfactor_Week)

- Marcus