Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

hagemann
New 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
Valued Contributor

Re: Variable in set Analysis

Hi Hagemann,

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

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

Thanks.

Aiolos Zhao

6 Replies
pradosh_thakur
Honored Contributor II

Re: Variable in set Analysis

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
Valued Contributor

Re: Variable in set Analysis

Hi Hagemann,

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

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

Thanks.

Aiolos Zhao

hagemann
New Contributor II

Re: Variable in set Analysis

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
New Contributor II

Re: Variable in set Analysis

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

Kind regards,
Hans Hagemann
pradosh_thakur
Honored Contributor II

Re: Variable in set Analysis

Highlighted
MVP & Luminary
MVP & Luminary

Re: Variable in set Analysis

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