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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Filtering Data using Macro

Hi,

I have two variable taking date from user -vFromDate & vToDate. I am using Input box to accept these values.

Based on these dates I need to filter data in straight table. My data should be based on following conditions.

SDF_DATE Between (Monthstart(Today()) and vToDate And (order_Type= 'FCST')

OR

SDF_DATE Between vFromDate and vToDate and Order_Status='Closed'

OR

SDF_Date<=vToDate and (Order_Type in( 'STD ORD','DEMO ORD')) and (Order_Status<>'CLOSED')

Thanks in advance.

2 Replies
Not applicable
Author

I calculated this in 'Add calculated dimension' with 1 or Null, and selected 'Suppressed when NULL'. It was very easy but took very long. I am just 2 months old in Qlikview. I hope to learn more in this area.

Not applicable
Author

Did you use Ifs in your calculated dimension? That could cause the slowdown. This logic should work in Set Analysis. How many expressions do you have in your charts?

To create this in Set Analysis, you need your expressions to be aggregate functions (most can be converted if they are not now). And then you would do something like:

Sum({
<SDF_DATE={">=$(=Monthstart(Today())<=vToDate"},order_Type={'FCST'}>+
<SDF_DATE={">=vFromDate<=vToDate"},Order_Status={'Closed'}>+
<SDF_Date={"<=vToDate"},Order_Type={'STD ORD','DEMO ORD'},Order_Status-={'CLOSED'}>
} Sales)


You may have to do some date formatting in there and I'm not sure if the variables will work directly like that, but that should be close to what you need. This Set Analysis logic would have to go into every expression. It should be quite a bit faster than Ifs.