Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

luisccmm
Contributor

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
Partner
Partner

Re: INVALID EXPRESSION , IF script function

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
Contributor II

Re: INVALID EXPRESSION , IF script function

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
Partner
Partner

Re: INVALID EXPRESSION , IF script function

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
Contributor II

Re: INVALID EXPRESSION , IF script function

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