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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
LiquidSword
Partner - Contributor III
Partner - Contributor III

why is this an invalid expression? (Concat Distinct, group by, order by)

Why is the first load an invalid expression? and how do I fix it?
 
RemoveDuplicate:
load 
Distinct InterDupeSequence as NewSequence,
    Customer_Code,
    CrossSales_Date,
    CrossSales_Key,
    CrossSales_Key_v2,
    Cross_Cate;
load 
concat(distinct Category, ',', CatOrder) as InterDupeSequence,
    Customer_Code,
    CrossSales_Date,
    CrossSales_Key,
    CrossSales_Key_v2,
    Cross_Cate
Resident StanLines2
group by LineNum
order by LineNum,CatOrder;
 
drop table StanLines2;
Labels (5)
1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @LiquidSword 

For starters your load using aggregation function (not the preceeding) is wrong as group by needs to contain all fields which aren't using grouping function so it should be:

Load
    concat(distinct Category, ',', CatOrder) as InterDupeSequence,
    Customer_Code,
    CrossSales_Date,
    CrossSales_Key,
    CrossSales_Key_v2,
    Cross_Cate
Resident StanLines2
group by
    Customer_Code,
    CrossSales_Date,
    CrossSales_Key,
    CrossSales_Key_v2,
    Cross_Cate
order by
    LineNum,CatOrde
;
cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.

View solution in original post

1 Reply
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @LiquidSword 

For starters your load using aggregation function (not the preceeding) is wrong as group by needs to contain all fields which aren't using grouping function so it should be:

Load
    concat(distinct Category, ',', CatOrder) as InterDupeSequence,
    Customer_Code,
    CrossSales_Date,
    CrossSales_Key,
    CrossSales_Key_v2,
    Cross_Cate
Resident StanLines2
group by
    Customer_Code,
    CrossSales_Date,
    CrossSales_Key,
    CrossSales_Key_v2,
    Cross_Cate
order by
    LineNum,CatOrde
;
cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.