Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

case when?


Hola, intento crear una variable en el proceso de carga de datos a través de "Case When". Soy nueva en el QlikView, alguien me puede ayudar:

Select Ciclo,

Tipo_item,

Mes_uso,

Fact,

case when (Ciclo<>`ciclo01` and Tipo_item=`Cuotas` and Mes_uso='201407') then (Fact+Fact*0.33333) else Fact end as  Efecto_c

from Tabla

Muchas gracias

14 Replies
sujeetsingh
Master III
Master III

if(Ciclo<>`ciclo01` and Tipo_item=`Cuotas` and Mes_uso='201407'),(Fact+Fact*0.33333),Fact) as  Efecto_c

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Select Ciclo,

  Tipo_item,

  Mes_uso,

  Fact,

  If(Ciclo<>'ciclo01' and Tipo_item='Cuotas' and Mes_uso='201407', Fact * 1.333333, Fact) As Efecto_c

from Tabla

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Gracias pero no funciona, el error es el siguiente:

Error_QlikView.png

antoniotiman
Master III
Master III

You can't use if() in SQL Sintax.

If()  is QV Sintax.

Your Sintax SQL is correct.

In QV -> Preceding LOAD

Table:

Load *,

If(Ciclo <> 'ciclo01' and ... and..., Fact*1.33333,Fact) as Efecto_c;

SQL Select

Ciclo,

Tipo_Item,

Mes_uso,

Fact

from Tabla;

Hola,

Antonio

anbu1984
Master III
Master III

From Google translate

Hello, I try to create a variable in the process of loading data through " Case When " . I am new to QlikView , someone can help me:

Do you have any issue in Case when?

If statement suggested above is for qlikview.

antoniotiman
Master III
Master III

Ciao Mihaela,

ho notato che usi ODBC per EXCEL.

In QV Script puoi caricare direttamente il Foglio Excel.

Vai in Script, Inserisci -> Istruzione di LOAD -> Carica da File. Segui il Wizard, Conferma.

Inserisci manualmente l' istruzione

If(Ciclo <> 'ciclo01' and ... and..., Fact*1.3333,Fact) as Efecto_c.

Hola,

Antonio

Anonymous
Not applicable
Author

Antoni Thanks, it worked. I did as you told me.

I put here the solution for anyone with the same problem, thanks!!!

Solucion_para_CaseWhere_QV.png

Anonymous
Not applicable
Author

I need to create another field using the new (Efecto_c), would be something like:

sum(If(Mes_uso='201407',`Efecto_c`,0) - If(Mes_uso='201406',`FN_FZ_con_FV`,0)) as Efecto_d

I have to group by all fields unless Mes_uso.

But I don't know where to put this formula, in the Script or in the expression of a pivot table?

antoniotiman
Master III
Master III

In the script.