Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm new to Qlik View, and I'm trying to use nested Ifs in the script to assign to each activity a cycle(defined by Cycle_start and Cycle_stop) but I keep getting the "Error in expression: If takes 2-3 parameters" error, and I didn't managed to find a solution so far.
Script:
LET Cycle1_start = MakeDate(2017,01,10);
Cycle1_stop= MakeDate(2017,04,29);
Cycle2_start=MakeDate(2017,05,02);
Cycle2_stop=MakeDate(2017,09,11);
Cycle3_start=MakeDate(2017,12,09);
Cycle3_stop=MakeDate(2018,01,08);
LOAD assegnazione as assign_date,
`cliente_farma_id`,
codice,
`user_id`,
If(Date(assign_date,DD-MM-YY)> $Cycle1_start, 'Ciclo 1',
If(Date(assign_date,DD-MM-YY) <= $Cycle2_stop and Date(assign_date,DD-MM-YY) >= $Cycle2_start),'Ciclo 2',
If(Date(assign_date,DD-MM-YY) < $Cycle3_Stop and Date(assign_date,DD-MM-YY) >= $Cycle3_Start,'Ciclo 3))) as Cycle;
SQL SELECT assegnazione,
Help please?
Check this?
LOAD assegnazione as assign_date,
`cliente_farma_id`,
codice,
`user_id`,
If(Date(assign_date,'DD-MM-YY') > $(Cycle1_start), 'Ciclo 1',
If(Date(assign_date,'DD-MM-YY') <= $(Cycle2_stop) and Date(assign_date,'DD-MM-YY') >= $(Cycle2_start),'Ciclo 2',
If(Date(assign_date,'DD-MM-YY') < $(Cycle3_Stop) and Date(assign_date,'DD-MM-YY') >= $(Cycle3_Start),'Ciclo 3'))) as Cycle;
SQL SELECT assegnazione,
`cliente_farma_id`,
codice,
`user_id`
FROM alfaintes.attivita;
Hi,
Date(DateField,'YY-MM-DD')
you are missing single quote
Regards
Check this?
LOAD assegnazione as assign_date,
`cliente_farma_id`,
codice,
`user_id`,
If(Date(assign_date,'DD-MM-YY') > $(Cycle1_start), 'Ciclo 1',
If(Date(assign_date,'DD-MM-YY') <= $(Cycle2_stop) and Date(assign_date,'DD-MM-YY') >= $(Cycle2_start),'Ciclo 2',
If(Date(assign_date,'DD-MM-YY') < $(Cycle3_Stop) and Date(assign_date,'DD-MM-YY') >= $(Cycle3_Start),'Ciclo 3'))) as Cycle;
SQL SELECT assegnazione,
`cliente_farma_id`,
codice,
`user_id`
FROM alfaintes.attivita;