Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
PetterAhlin
Partner - Contributor
Partner - Contributor

Set Analysis with multiple variables for one field

//I have two variables assigned with YearMonth values in the load script.
vL.LastMonth //e.g. 202003
vL.StartMonth //e.g. 202001 or 202004
 
I have a set analysis in an expression in a straight table chart. The set analysis is used to make sure the record I extract in the Only function is of last month but not earlier than given start month. I tried the different values in StartMonth to check if the set analysis works as I expected. A value should be returned for TargetField when assigning 202001 to vL.StartMonth. No value should be returned if 202004 is assigned to the variable.
 
The following set analysis does NOT work for intended purpose:
=Only({1<YearMonthField={"=$(vL.LastMonth) >=$(vL.StartMonth)"}>} TargetField)
 
However, if I define the set analysis the following way (with two instances of same field name) it works fine:
=Only({1<YearMonthField={"=$(vL.LastMonth)"}, YearMonthField={">=$(vL.StartMonth)"}>} TargetField)

I probably do some simple error, but can't understand what causes the first Set Analysis above to fail.
 
Kindly, Petter Ahlin
Labels (2)
1 Solution

Accepted Solutions
PetterAhlin
Partner - Contributor
Partner - Contributor
Author

Thank you for your reply. The case can be closed. It was a matter of a mistake I made expecting the data to be different than it actually was. This post can be closed and deleted, thank you.

Kind regards,

Petter

View solution in original post

2 Replies
sunny_talwar

What exactly is your condition here? I am not sure what exactly are you trying to do?

PetterAhlin
Partner - Contributor
Partner - Contributor
Author

Thank you for your reply. The case can be closed. It was a matter of a mistake I made expecting the data to be different than it actually was. This post can be closed and deleted, thank you.

Kind regards,

Petter