Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Syntax for set analysis & dates

Good afternoon,

in the script, I have

..............

Date(Floor(Monthend(Addmonths([Beginndatum],iterno()-1)))) as MonatsUltimo,

...............

Year (MonatsUltimo) & '.' &  Month (MonatsUltimo) as JJJJ.MM,

In an input box, I define a variable "KeyDate" with format YYYY.MM. Finally, in the chart properties, I define an expression

count({<JJJJ.MM={"$(Stichtag)"}>}distinct(Personalnr)) // let´s call this (a)

So far, so good. Now I want to define further expressions for previous years, i.e. if KeyDate is 2015.12, I´d like to also have 2014.12, 2013.12, and 2012.12.

Using a text box, I see this expression works and delivers 2014.12 for KeyDate = 2015.12:

=left($(KeyDate)-1,4) & '.' & right($(KeyDate),2) // let´s call this (b)

Why is then this expression not working, if I´m just inserting (b) into (a)?

count({<JJJJ.MM={'=left($(KeyDate)-1,4) & '.' & right($(KeyDate),2)'}>}distinct(Personalnr))

Many thanks!

3 Replies
sunny_talwar

Try this:

Count({<JJJJ.MM={"$(=Left($(KeyDate)-1, 4) & '.' & Right($(KeyDate), 2))"}>} Distinct(Personalnr))

Not applicable
Author

Works, thanks!

sunny_talwar

Awesome

Would you mind closing this thread by marking the correct answer.

Best,

Sunny