Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Sirs, I have stated the following script and I need to do a calculus with last week data.
fechas:
LOAD Distinct
fecha_union,
year (fecha_union) as Año,
Month (fecha_union) as Mes,
day(fecha_union) as Dia,
MonthName (fecha_union) as Periodo,
Num#(date (fecha_union, 'YYYYMM')) as PeriodoNum,
Week(fecha_union) as Semana,
Weekname(fecha_union) as Numero_Semana,
date(fecha_union) as fecha
Resident union;
I stated the following variables
vSemanaMax= Max(Numero_Semana)
vSemanaMax_m1 = Max(Numero_Semana)-1
Then the following expression, gives me a null result
sum({<Año=, Mes=, fecha=, PeriodoNum=, Numero_Semana={$(vSemanaMax)}>}numerador_icf) / sum({<Año=, Mes=, fecha=,PeriodoNum=, Numero_Semana = {$(vSemanaMax)}>} denominador_icf)
Where is the problem?
Thanks in advance
May be add your variable within single quotes like this and add = sign within the dollar sign expansion
Sum({<Año=, Mes=, fecha=, PeriodoNum=, Numero_Semana={'$(=vSemanaMax)'}>}numerador_icf) /Sum({<Año=, Mes=, fecha=,PeriodoNum=, Numero_Semana = {'$(=vSemanaMax)'}>} denominador_icf)
Try your variables like this
vSemanaMax= WeekName(Max(fecha_union));
vSemanaMax_m1 = WeekName(Max(fecha_union)-7);
Ok I changed the variables, now it appears this following error.
Should I fix the expression?
sum({<Año=, Mes=, fecha=, PeriodoNum=, Numero_Semana={$(vSemanaMax)}>}numerador_icf) /sum({<Año=, Mes=, fecha=,PeriodoNum=, Numero_Semana = {$(vSemanaMax)}>} denominador_icf)
May be add your variable within single quotes like this and add = sign within the dollar sign expansion
Sum({<Año=, Mes=, fecha=, PeriodoNum=, Numero_Semana={'$(=vSemanaMax)'}>}numerador_icf) /Sum({<Año=, Mes=, fecha=,PeriodoNum=, Numero_Semana = {'$(=vSemanaMax)'}>} denominador_icf)
Great!!, it works fine now,
What is the function of the single quotes?
You will be able to find all the information here: