Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Someone can tell me where is the mistake in this:
I'm trying to get the value of the last month but it seems as my variable doesn't function
It's working but not how you intended
-----
In your image I observed that you have 2017 selected for year(año) and January(ene) selected for month(Mes)?
the variable vMesAnterior returns 12
if you have 2017 for year selected and the variable returns 12 then I assume there isn't any data for year 2017 and month 12? so the expression is correct in returning 0
-----
I recommend creating an expression where if you want previous month data it would be wiser to have an unique id for each month and year so you can have a rolling calendar
in the script in your calendar table I recommend creating a MonthID field like so or something like this
Year(max(DATEfield)-1) *12 + num(month(max(DATEfield))) as MESID
reload and in your expression input the following expression with the new field MESID
Sum({$<MESID = {“>=$(=Max(MESID) – 1)<=$(=Max(MESID))”}, Año = , Mes = >} Valor_Cuenta)
this expression gives you a range summation
Try adding an equal sign
Num_Mes = {$(=vMesAnterior)}
Thanks for answering but it has not worked
I think you might have to ignore selection in Mes also
Num_Mes = {$(=vMesAnterior)}, Mes
Bad news, it does not work either
Would you be able to share a sample?
It's working but not how you intended
-----
In your image I observed that you have 2017 selected for year(año) and January(ene) selected for month(Mes)?
the variable vMesAnterior returns 12
if you have 2017 for year selected and the variable returns 12 then I assume there isn't any data for year 2017 and month 12? so the expression is correct in returning 0
-----
I recommend creating an expression where if you want previous month data it would be wiser to have an unique id for each month and year so you can have a rolling calendar
in the script in your calendar table I recommend creating a MonthID field like so or something like this
Year(max(DATEfield)-1) *12 + num(month(max(DATEfield))) as MESID
reload and in your expression input the following expression with the new field MESID
Sum({$<MESID = {“>=$(=Max(MESID) – 1)<=$(=Max(MESID))”}, Año = , Mes = >} Valor_Cuenta)
this expression gives you a range summation
Thank you so much! It works fine!