Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
HAmzehAF
Partner - Creator
Partner - Creator

The following error occurred: Invalid expression

Sales:
LOAD 
//DOCNO,
    TRXH_LOC_CODE,
      "City Centre",
      Channel,
   // UPPER(LOCN) as Store,
    DIVISION,
     Division,
 
    DIVISION & ' - ' & Division as DivisionName,
 
 Division_Group,
  //  CATEGORY ,
    CATEGORY AS group_code,
    Group,
    SUPP_CODE,
    Supplier,
  // SUPP_CODE&' - '& SUP_NAME as SupplierName,
    PRODUCT,
//     DESCRIPTION as Product,
  //  PRODUCT &' - '& DESCRIPTION as Product,
    BRAND,
     Brand,
  WAC,
    RSP,
    LCPRICE,
  //  SOLDQTY,
  //  SALE,
    Return_flag,
  Date,
   Year,
  Month,
   Day,
   DateNum,
 // TIME(Timestamp#(TIME,'hh:mm:ss TT')) as TIME,
  //  NAT_CODE,
  //  IF(NATIONALITY='unknmown','unknown', NATIONALITY) as NATIONALITY,
   // if(NATIONALITY='Kuwaiti','Kuwaiti','Non-Kuwaiti') as NATIONALITY_Group,
  //  CASHIER,
  //  COUNTER,
    LEVEL0,
    LEVEL1 AS cat,
    NegMflag,
   // FRN_FLAG,
    WAC1,
    SUM(SOLDQTY) AS Sold_qty,
 SUM(SALE) AS Sale,
  SUM(WAC*SOLDQTY) AS COS
    FROM [lib://QVDs (r)/Sales.qvd]
(qvd) ;
 
 
this error keeps coming out for me, can someone help me ?
 
2 Replies
dennemanr
Contributor II
Contributor II

You'll need to provide a "group by" function to use sum. Please read the aggregation function documentation: https://help.qlik.com/en-US/sense/November2023/Subsystems/Hub/Content/Sense_Hub/Scripting/Aggregatio...

anat
Master
Master

you have to use resident and group by to perform aggregate functions like sum ,max at script level

https://help.qlik.com/en-US/sense/November2023/Subsystems/Hub/Content/Sense_Hub/Scripting/Aggregatio...