Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
sersal10
Creator
Creator

how to deselect a "complex" variable in an expression

Hi all,

In a filter, I have a field with this expression:  ={<previous_year_comparison = 1>} event_name

Then I have a line chart with an expression that I want the other field not to be taken into account.

This is the expression: Sum({< year_event=,event_name=, month_event=, event_code = p(previous_event_code)>} quantity )

I need to add the first expression somehow like this:  Sum({< INSERT HERE EXPRESSION =, year_event=,event_name=, ....

How could I do it? Many thanks.

Labels (1)
3 Replies
Anil_Babu_Samineni

@sersal10 The requirement is unclear, by reading context you maybe assuming to keep here.

Sum({< previous_year_comparison = {1}, year_event=,event_name=, month_event=, event_code = p(previous_event_code)>} quantity )

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sersal10
Creator
Creator
Author

Hi Anil, 

That didn't work. There may not be a possibility to do this in Qlik. Hence I created a new column in my database with this code:

CASE
WHEN py.previous_year_comparison = 1 THEN e.event_name
ELSE NULL
END AS event_to_compare
 
This way I can just use as a field in a filter instead of ={<previous_year_comparison = 1>} event_name
and then I can use the field in the expression for the chart so the selection of the filter is not taken into account: 
 
Sum({< year_event=, month_event=, event_code = p(previous_event_code), event_to_compare=, event_name= >} quantity)
 
So this was my solution. I didn´t to create an extra column in my database though, as it is redundant as I have already a boolean to distinguish the events I want to study.
 
If sb comes with another solution using Qlik, It is very welcomed.
 
Thanks anyway,

Sergio.
Anil_Babu_Samineni

@sersal10 If it is in Qlik, the same way you can written like.

If(previous_year_comparison = 1, Sum({<year_event=,event_name=, month_event=, event_code = p(previous_event_code)>} quantity ), Null())

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful