Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
purna
Contributor III
Contributor III

Using Where clause in back end to find the 90days value dynamically..

How to find the sales value of last 90days and first 90days for the "category xxx "in back end (script) using where clause
Dynamically.
 

Thanks in advance...

2 Replies
OmarBenSalem

Difficult to answer without mock data; but let me try !

 

I'll assume you have a table as follow :

 

Table:

load 

ID, DateField, SomeData from source;

What I would do :

create 2 variables one for minDate and one for MaxDate

Temp:

Load

               min(DateField) as minDate,

               max(DateField) as maxDate

Resident Table;

 

Let varMinDate = Num(Peek('minDate', 0, 'Temp'));

Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));

 

drop table Temp;

 

That done :

we could do something like this :

noconcatenate

load *,

if(DateField> ($(varMaxDate)-90,1) as FlagLast90, 

if(DateField> ($(varMinDate )+90,1) as FlagFirst90

resident Table;

drop table Table;

 

and use these 2 flags to select what u need.. hope the idea is clear?*

Regards,

Omar BEN SALEM

 

 

purna
Contributor III
Contributor III
Author

Hello Omar,

Thanks a lot for the response, Yes this will work ,but i want this using where clause last 90 days sales for category furniture DYNAMICALLY.

 

Hear i am attaching the XL for your ref...

Regards..