Qlik Community

Ask a Question

New to Qlik Sense

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

Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

SET ANALYSIS with 3 conditions

Hello, I am trying the represent data in a barchart like this, If the user does not select any date, show the yesterday data.

If he selects a date or a range of dates show the data in that specific range.

I am using the following the setanalysis:

=IF(GetSelectedCount(DateAll)>0, AVG({<delta= {">-25<8"},[table2.mach_group]={"BCA"}>} delta),

AVG({$<DateAll={'$(YESTERDAY)'},delta= {">-25<8"},[table2.mach_group]={"BCA"}>} delta))


I am using the same logic for other representation and it works(but with only 2 set analysis). Can someone tell me if I am integrating the 3 conditions correct in the formula?

I tested the date format using the bellow formula and it works. So the date fromat should be correct 

=IF(GetSelectedCount(DateAll)>0, 1, 2) 

Labels (1)
2 Replies

You can perform 3rd condition like

=IF(GetSelectedCount(DateAll)>0, AVG({<delta= {">-25<8"},[table2.mach_group]={"BCA"}>} delta),

If(GetSelectedCount(DateAll)>0, <Your third condition>, AVG({$<DateAll={'$(YESTERDAY)'},delta= {">-25<8"},[table2.mach_group]={"BCA"}>} delta)))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Master II
Master II

Hi CostinelRO,

May be the issue is with your $(YESTERDAY) variable. Try this once

Define variable like this:

YESTERDAY = date(max({1} DateAll)-1,'Yourdateformat') //make sure to add a "=" in the variable definition, also i believe you have data available for the yesterday 🙂 

Best Regards,