Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
New Contributor II

Variable Let IN IF ELSEIF

Hola, tengo un problema con la lógica de variables y cómo hacer recargas según su valoración, en el ejemplo siguiente se cumple la condición de Sum(fabs(Factor_Distrib_CAAP)) es igual a 1 por lo tanto la carga debe cumplirse en el primer IF.

 

Hi, I work in QS and i have to do something like this, but if vDistrib_CAAP = 1 this doesnt work like i want

 

Distribucion_CAAP:
NoConcatenate
LOAD Mercado as Mercado_Distrib_CAAP,
Sum(Valor_Distrib/Valor_Distrib_Total) as Factor_Distrib_CAAP
Resident Distribucion_CAAP_1
Group by Mercado;

Let vDistrib_CAAP = 'Sum(fabs(Factor_Distrib_CAAP))';

Distribucion_Margen:
NoConcatenate
LOAD Mercado as Mercado_Distrib_Margen,
Sum(Valor_Distrib/Valor_Distrib_Total) as Factor_Distrib_Margen

Let vDistrib_Margen = 'Sum(fabs(Factor_Distrib_Margen))';

 

IF '$(vDistrib_CAAP)=1' then

LOAD
Mercado_Distrib_CAAP as Mercado_Distrib,
"Factor_Distrib_CAAP" as Factor_Distrib
Resident Distribucion_CAAP;

ElseIF '$(vDistrib_Margen)=1' then
LOAD
Mercado_Distrib_Margen as Mercado_Distrib,
"Factor_Distrib_Margen" as Factor_Distrib
Resident Distribucion_Margen;

Else

LOAD
Mercado_Distrib_CLP as Mercado_Distrib,
"Factor_Distrib_CLP" as Factor_Distrib
Resident Distribucion_CLP;

Labels (1)
1 Reply
Highlighted
New Contributor II

Re: Variable Let IN IF ELSEIF

Someone?