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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

syntax problem less than or equal to addyears with variable

hi Guys!

hope you could help me out.

I would like to calculate a sum till a certain time point in previous year, depending on what do I choose in a variable, below is what I came up with, nevertheless it doesn't work, although similar builds in the project do.

Sum({$<

[Date]= {"$(<=addyears(date('$(vRollingForecastBeginning)'), -1))"}

>}

ActualsValue)

The expression alone:

addyears(date('$(vRollingForecastBeginning)'), -1)

returns '07/01/2016' and reacts to variable changing correctly, [Date] is formatted as Date in script so the formats should be aligned.


do you have any ideas?


thanks in advance,

Bart



1 Solution

Accepted Solutions
marcus_sommer

Your expression should be rather look like:

Sum({$<

[Date]= {"<=$(=addyears(date('$(vRollingForecastBeginning)'), -1))"}

>}

ActualsValue)

- Marcus

View solution in original post

5 Replies
marcus_sommer

Your expression should be rather look like:

Sum({$<

[Date]= {"<=$(=addyears(date('$(vRollingForecastBeginning)'), -1))"}

>}

ActualsValue)

- Marcus

Anonymous
Not applicable
Author

Hi Bartosz,

I've edited the title of this thread to replace "<=" with "less than or equal to", as the symbols were cause a page display issue.

Best regards,

Qlik Community Team

Not applicable
Author

hi Marcus,

works like a charm, thank you!

I wonder why in some case you need the additional "=" and in some you don't...

best

Bart

Not applicable
Author

hi Jeremy,

thanks!

regards,

Bart

marcus_sommer

Here it's very well explained why and where the "=" made a difference:

The Little Equals Sign

The Magic of Dollar Expansions

- Marcus