Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
roxys373s
Contributor II
Contributor II

SQL to set expression

Hello!

 

I am trying to create a way on my sheet so that specific rows from my table are selected. I know I can load it using SQL: 

roxys373s_0-1658495656863.png

That's the condition that picks out the proper rows classified as Current Sales. However, for the exact opposite expression, batch_date < start_date, the rows that are true for this statement are Future Sales. I need to be able to look at Current Sales, Forward Sales, or both on my sheet, instead of just one. 

And I don't think loading the table multiple times is efficient and I also am not sure if Qlik would recognize both separately if I were to use a key to connect them.

Can someone please clarify my logic or give me ways to be able to show both conditions on the sheet?

I tried using a button, and I was thinking it could select the batch_dates for which batch_date<start_date is true, but the button hasn't been able to recognize the expression and I'm also not sure what action I would use. Am I doing something wrong with that or is there another option? 

3 Replies
sidhiq91
Specialist II
Specialist II

@roxys373s  If you are using in KPI to find some kind of Sales then it would be like below:

Sum({<Batch_date={">=$(=Start_date)<$(=Start_date)"}>}LineSalesAmount)

In Straight table it would be like below

Only({<Batch_date={">=$(=Start_date)<$(=Start_date)"}>}OrderDate)

Let me know if this worked.

roxys373s
Contributor II
Contributor II
Author

but this would just create a table with that condition applied right?

Is there anyway so that I can choose when the condition is applied? That's why I was trying to use a button so the table could show all the data, but when preferred to see the condition applied, it would make the respective selections. 

sidhiq91
Specialist II
Specialist II

@roxys373s  Then you can create a Filter right using the same logic, something like below

if(Batch_date>=start_date,'Current Sales',

 if(Batch_Date<start_date,'Future Sales'))

Hopefully this should resolve your issue.