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: 
TomBond77
Specialist
Specialist

Invalid expression

Hi experts

I am getting an "invalid expression" error executing this script. Any ideas how to fix it?

Thanks, Tom

 

LOAD
sum(AMOUNT) as amount,
ACCOUNT as KONTO

,if (len(trim(CODE_B))>0, CODE_B, 0) as ANSV_ID 

,if (len(trim(CODE_F))>0, CODE_F, 0) as CounterPart 

,CODE_C as PROJEKT_Id 
,CODE_C as %Key_Project 
,YEAR_PERIOD_KEY as period
,CODE_E as OrderClass 

,'IFS-' & if(len(CODE_E)=0,0,CODE_E) as %Key_OrderClass 
,'IFS IL Group' as Source

FROM [lib://$(v_Env)/04_Datasource/01_QVD/INTERNAL.csv]
(txt, utf8, embedded labels, delimiter is ',', msq)

group by CODE_B, CODE_F, CODE_C, YEAR_PERIOD_KEY, CODE_E;

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

ACCOUNT isn't listed within the group by. Further listing fields like your CODE_# isn't always enough, if they are used within expressions like the if-loops - means you may need to include the if-loop also in the group by, like:

group by ACCOUNT,  if (len(trim(CODE_B))>0, CODE_B, 0), ....

- Marcus

View solution in original post

1 Reply
marcus_sommer

ACCOUNT isn't listed within the group by. Further listing fields like your CODE_# isn't always enough, if they are used within expressions like the if-loops - means you may need to include the if-loop also in the group by, like:

group by ACCOUNT,  if (len(trim(CODE_B))>0, CODE_B, 0), ....

- Marcus