Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

gbedford
New 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

Re: Load Script Question

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
Contributor

Re: Load Script Question

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

Community Browser