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.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
gbedford
Contributor
Contributor

Load Script Question

Hi, I am trying to create a App that only pulls in transactional data far one particular product category.  I am not sure how to do this. 
I am currently pulling in transactional data that includes a productID field.  It is then joined with a product information file using productID.. 
I want to use Category to determine what transactional data to pull in.  I tried adding a Where Category = 'Sheets' statement but can't seem to get it to work.
Any suggestions?

Thanks.


LOAD

    ProductID,
    "Product Name",
    Category,
    "Sub Category",
    Vendor,

FROM [lib://QVD (DM) (sleepcountry_qlsrv)/MasterProductTable.qvd]
(qvd);

LOAD

"Date",
  NetSales,
     NetUnits,
     OrderID,
     ProductID,

   
FROM [lib://QVD (DM) (sleepcountry_qlsrv)/BTADelivered2014.qvd]
(qvd)

Where Category = 'Sheets';

2 Replies
sunny_talwar

May be try this

LOAD ProductID,

    If(Category = 'Sheets', ProductID) as ProductIDTemp,
    "Product Name",
    Category,
    "Sub Category",
    Vendor,

FROM [lib://QVD (DM) (sleepcountry_qlsrv)/MasterProductTable.qvd]
(qvd);

LOAD

"Date",
  NetSales,
    NetUnits,
    OrderID,
    ProductID,

FROM [lib://QVD (DM) (sleepcountry_qlsrv)/BTADelivered2014.qvd] (qvd)

Where Exists(ProductIDTemp, ProductID);

sarahplymale
Creator
Creator

You could try:

Product:

LOAD

    ProductID,
    "Product Name",
    Category,
    "Sub Category",
    Vendor,

FROM [lib://QVD (DM) (sleepcountry_qlsrv)/MasterProductTable.qvd]
(qvd)

Where Category = 'Sheets';

LEFT KEEP(Product)

LOAD

"Date",
  NetSales,
     NetUnits,
     OrderID,
     ProductID   
FROM [lib://QVD (DM) (sleepcountry_qlsrv)/BTADelivered2014.qvd]
(qvd)

The "left keep" statement should only keep transactional orders where the product ID is on the Product table, which in this case should be only "Sheets".

Sarah