Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Sum({$<Ano ={$(=Year(today()))},Mês={$(=Month(today()))}, [operacao]={'V'} >}valor)
return the day: 09/04/2016 : VALUE: X
====================================================
As I think for the same day of the previous month
in the above expression
return the day: 09/03/2016 : Value: X
As had been and expression?
Hi Agnaldo,
you are using a cyclic month field which is not really good to use when you want to cross year bounderies.
Have a look at Henrics blog
In the second half, he exactely describes how you can get the previous month value using a sequential month field.
Hope this helps,
Stefan
P.S. see also
The Magic of Set Analysis - Point In Time Reporting • Blog • AfterSync
you would have a hint of the expression:
I take a month before today's date
09/04/2016
for
09/03/2016
Brazil
yes, in the referenced blog post there is a detailed example:
Script:
Date(MonthStart(Date),'MMM-YY') as Month,
Expressions:
Sum( {$<Month={"$(=Date(Max(Month),'MMM-YY'))"}>} Amount )
Sum( {$<Month={"$(=Date(AddMonths(Max(Month),-1),'MMM-YY'))"}>} Amount )
Did not work
Sum({$<Ano ={$(=Year(today()))},Mês={$(=Month(today()))},Dia={$(=Day(today()))}, [operacao]={'V'} >}valor)
retorna: 09/04/2016
Sum({$<Ano ={$(=Year(today()))},Mês={$(=Month(today()-1))},Dia={$(=Day(today()))}, [operacao]={'V'} >}valor)
retorna: 09/03/2016
Excuse me
He missed the day.
I need something,
But it does not work.
First, create an additional field in your script, with a sequential month:
Date(MonthStart(Fecha),'MMM-YY') as AnoMes,
then use this field in your set expressions:
Sum({$<Ano, Mês, Dia, AnoMes ={"$(=Date(Today(),'MMM-YY'))"}, [operacao]={'V'} >}valor)
Sum({$<Ano, Mês, Dia, AnoMes ={"$(=Date(Addmonths(Today(),-1),'MMM-YY'))"}, [operacao]={'V'} >}valor)
Sum({$<Ano, Mês, Dia, MesAno ={"$(=Date(Addmonths(Today(),-1),'MMM-YYYY'))"}, [operacao]={'V'} >}valor)
RETURNE : 0
Ah, ignore my previous post, this will not work.
You were asking for the previous month same day:
Do you have a Date (Fecha) field?
Sum({$< Fecha={"$(=Date(Addmonths(Today(),-1),'DD/MM/YYYY'))"}, [operacao]={'V'} >}valor)