Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Giansonn
Creator
Creator

how can you use multiple functions for a single variable in a set expression?

I am running a chart that shows me some time values but I want to exclude items that have not had enough time to be comparable. To do this I fetch a value from the filter in order to limit the dates in the data. Only I want to have multiple expressions for the same variable, how can I do this?

This is what my set expression looks like:

 

count( {<[date]={"<=$(=date(($(varMaxDate)-v_Max_week_number*7),'DD/MM/YYYY'))"}>} ID)

 

but I would like to have three expressions for the date variable,  potentially using rangemin like this:

 

=date(=rangemin(=date(($(varMaxDate)-v_Max_week_number*7),'DD/MM/YYYY')),=date(($(varMaxDate)-v_Max_day_number),'DD/MM/YYYY')),=date(($(varMaxDate)-v_Max_sale_number*30.42),'DD/MM/YYYY'))))

 

This however does not work, how can I formulate this expression to make it work?

Labels (3)
1 Solution

Accepted Solutions
vamsee
Specialist
Specialist

 

 

Try using one more variable, like

 

vExpression = If(Condition1=TRUE,'=date(=rangemin(=date(($(varMaxDate)-v_Max_week_number*7),'DD/MM/YYYY'))',
If(Condition2=TRUE, '=date(($(varMaxDate)-v_Max_day_number),'DD/MM/YYYY')),'

If(Condition3=TRUE, '=date(($(varMaxDate)-v_Max_sale_number*30.42),'DD/MM/YYYY'))))', 'Null()'

)))

 

 

Use this variable in your expression 

 

count( {<date={"$(vExpression)"}>} ID)

 

While creating the chart the expression might show an error but, would still work.

View solution in original post

2 Replies
vamsee
Specialist
Specialist

 

 

Try using one more variable, like

 

vExpression = If(Condition1=TRUE,'=date(=rangemin(=date(($(varMaxDate)-v_Max_week_number*7),'DD/MM/YYYY'))',
If(Condition2=TRUE, '=date(($(varMaxDate)-v_Max_day_number),'DD/MM/YYYY')),'

If(Condition3=TRUE, '=date(($(varMaxDate)-v_Max_sale_number*30.42),'DD/MM/YYYY'))))', 'Null()'

)))

 

 

Use this variable in your expression 

 

count( {<date={"$(vExpression)"}>} ID)

 

While creating the chart the expression might show an error but, would still work.

Giansonn
Creator
Creator
Author

This is a fantastic idea! However I think I will do it using rangemax of the v_max variables times by their day number in a new variable, I will let you know how it goes!