Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Qlik Insider: SaaS capabilities for Data Integration and Analytics, May 25th! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
SerSwagster
Creator
Creator

Subtraction of a variable

Hi everyone. I created this variable:

last_year = year(today())-1

In the following script, I need to do a count reffered to two years ago:

count({1<[Years]={"($(last_year) - 1)"},[Team]=P([Team])>}distinct [Player])

There is a syntax mistake when calculating last year - 1. How can I fix it?

1 Solution

Accepted Solutions
marcus_sommer
MVP & Luminary
MVP & Luminary

There is a typo. Change it to:

count({1<[Years]={"$(=$(last_year) - 1)"},[Team]=P([Team])>}distinct [Player])

- Marcus

View solution in original post

3 Replies
marcus_sommer
MVP & Luminary
MVP & Luminary

You could try:

let last_year = year(today())-1;

count({1<[Years]={"$=($(last_year) - 1)"},[Team]=P([Team])>}distinct [Player])

- Marcus

SerSwagster
Creator
Creator
Author

Hi Marcus,

neither with {"$=($(last_year) - 1)"}, a result is given back. It's very strange, because putting a value to years value, there is a result. There is something wrong with "$" character.

 

marcus_sommer
MVP & Luminary
MVP & Luminary

There is a typo. Change it to:

count({1<[Years]={"$(=$(last_year) - 1)"},[Team]=P([Team])>}distinct [Player])

- Marcus