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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Where clause in preceding load

Hi Qlik people,

I an loading data in from some spreadsheets, and I'm trying to limit it to recent dates but it is not working. It always pulls the full dataset  I have tried limiting the load with 'where' clauses on  several fields, but no joy.

Is is possible to use a 'where' clause with a preceding load? If so, anyone have any ideas why this doesn't work?

SALES:
Load
*
Where Year > 2014
;

LOAD If(Len(Trim([Originator ID]))=8,'00'& [Originator ID],[Originator ID]) as SalesID,
Floor(MonthEnd(Date#(Month & '-' & Year,'MMM-YYYY'))) as EOM,
Month,
Year,
State,
if(isnull(New)=-1,0,New) as Total_New_Sales,
if(isnull(Used)=-1,0,Used) as Total_Used_Sales  ,
if(isnull(New)=-1,0,New) +  if(isnull(Used)=-1,0,Used) as Total_Sales
FROM
[$(vImportPath)Retail Sales*.xlsx]
(
ooxml, embedded labels, table is Sheet1);

Store SALES Into '$(vQVDDestPath)SALES.qvd';
 
exit Script

The strange thing is I looked at the QVD with a qvd viewer, and it shows the values I want excluded differently - see how 2013 is right justified?

I checked and all the data is the same format in the excel sheet.

Thanks Community!

Fred.

Edit - I know I could put the 'where' clause in the initial load and not use preceding load. I am actually taking year and month, making a date, then comparing 'where newDate > $(variable) and newDate < today() plus a few other things that make preceding load a nice way to run. The script I posted is simplified for troubleshooting.

0 Replies