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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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
MVP
MVP

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