Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
luisccmm
Creator
Creator

INVALID EXPRESSION , IF script function

Hi,

 

Why the following  SCRITP code is FAILING in this "IF" FUNCTION,

 

 IF(Action='Action1',SUM(SALES_CONVERTED)) as Sales_converted_Action1

ERROR:  Invalidad Expression

That IF function is located at the bottom.

 

 

Conversion_rates_mapping:
Mapping LOAD
 Action, 
 Conver_rate
 FROM [lib://TEST APP/Conversion_rates.xlsx]
(ooxml, embedded labels, table is CONVERSION_RATES);


[DATE_PRODUCTION]:
LOAD
    "Date",
    Action,
    Production,
    Production  *ApplyMap('Conversion_rates_mapping', Action) as SALES_CONVERTED
 FROM [lib://TEST APP/Conversion_rates.xlsx]
(ooxml, embedded labels, table is DATE_PRODUCTION);


[DATE_PRODUCTION_3]:
NoConcatenate
LOAD 
    "Date",
    IF(Action='Action1',SUM(SALES_CONVERTED)) as Sales_converted_Action1
    Conversion_rates_mapping:
Mapping LOAD
 Action, 
 Conver_rate
 FROM [lib://TEST APP/Conversion_rates.xlsx]
(ooxml, embedded labels, table is CONVERSION_RATES);


[DATE_PRODUCTION]:
LOAD
    "Date",
    Action,
    Production,
    Production  *ApplyMap('Conversion_rates_mapping', Action) as SALES_CONVERTED
 FROM [lib://TEST APP/Conversion_rates.xlsx]
(ooxml, embedded labels, table is DATE_PRODUCTION);


[DATE_PRODUCTION_3]:
NoConcatenate
LOAD 
    "Date",
    IF(Action='Action1',SUM(SALES_CONVERTED)) as Sales_converted_Action1
   
Resident [DATE_PRODUCTION];
Resident [DATE_PRODUCTION];

 

 

Labels (4)
2 Solutions

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

When we are performing aggregation at script, eg(Sum):

Group by clause is required.

[DATE_PRODUCTION_3]:
NoConcatenate
LOAD 
    "Date",
    IF(Action='Action1',SUM(SALES_CONVERTED)) as Sales_converted_Action1
resident <Your TableName>
Group by
Date;

View solution in original post

Jesh19
Creator II
Creator II

You're missing Group By in your script.

Try this..

Load Date,

          IF(Action='Action1',SUM(SALES_CONVERTED)) as Sales_converted_Action1

Resident Date_Production

Group By Date;

View solution in original post

2 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

When we are performing aggregation at script, eg(Sum):

Group by clause is required.

[DATE_PRODUCTION_3]:
NoConcatenate
LOAD 
    "Date",
    IF(Action='Action1',SUM(SALES_CONVERTED)) as Sales_converted_Action1
resident <Your TableName>
Group by
Date;
Jesh19
Creator II
Creator II

You're missing Group By in your script.

Try this..

Load Date,

          IF(Action='Action1',SUM(SALES_CONVERTED)) as Sales_converted_Action1

Resident Date_Production

Group By Date;