Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I need your help. Below I have the code that I calculate the balance for the current month. So today I will have sum until 23.04. I would like to compare it to the previous month, for this I have a variable vPreviousMonthYear = Date((Monthname(Today())-1),'MMM-YYYY').
I would like it to add up so far for the current month and divide by the total for the previous month for the same number of days as in the current month so that I can see what the dynamics are.
Sum({MonthYear={"$(vCurrentMonthYear)"}=>}balance)
is anyone able to help me?
Hi,
I would suggest you to use this expression for Previous Month:
vPreviousMonthYear =Date(AddMonths(Today(),-1),'DD-MM-YYYY')
this is the output:
and if you need only Month and Year you can use:
vPreviousMonthYear =Date(AddMonths(Today(),-1),'MMM-YYYY')
as you have used in your expression.
Then follow your expression for calculating the balance for the current month divide by last month.
Hope this helps,
help user find answers ! don't forget to mark a solution that work for you and click the like button!
thx, but this expression give me only 25-03-2023, I need all days, from start previous month to 24-03.2023 (no today, just ended days)
Hi
Try like below
Sum({<Date={">=$(=Monthstart(Max(Date),-1))<=$(=Date(AddMonths(Max(Date),-1)))"},MonthYear=, Year=, Month=>}balance)
is it sure to take last month's range because it gives me the same value as current month?
You can use this expression:
Sum({<Date={">=$(=MonthStart($(vPreviousMonthYear)))<=$(=date($(vPreviousMonthYear)))"},MonthYear=, Year=, Month=>}Balance)
this expression will give you below output
My below output is like this, i don't see date
I have used vPreviousMonthYear =Date(AddMonths(Today(),-1),'MMM-YYYY') for vPreviousMonth
Or else
you can use the expression:
Sum({<Date={">=$(=Monthstart(Max(Date),-1))<=$(=Date(AddMonths(Max(Date),-1)))"},MonthYear=, Year=, Month=>}balance)
instead of using PreviousMonthYear variable.