Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
gz
Contributor III
Contributor III

total balance, dynamics

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)

 

 

Labels (1)
8 Replies
gz
Contributor III
Contributor III
Author

is anyone able to help me?

Rams-
Creator
Creator

Hi,

I would suggest you to use this expression for Previous Month:

vPreviousMonthYear =Date(AddMonths(Today(),-1),'DD-MM-YYYY')

this is the output:

Rams_0-1682403278207.png

 

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!

gz
Contributor III
Contributor III
Author

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)

MayilVahanan

Hi

Try like below

Sum({<Date={">=$(=Monthstart(Max(Date),-1))<=$(=Date(AddMonths(Max(Date),-1)))"},MonthYear=, Year=, Month=>}balance)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
gz
Contributor III
Contributor III
Author

is it sure to take last month's range because it gives me the same value as current month?

Rams-
Creator
Creator

You can use this expression:

Sum({<Date={">=$(=MonthStart($(vPreviousMonthYear)))<=$(=date($(vPreviousMonthYear)))"},MonthYear=, Year=, Month=>}Balance)

this expression will give you below output

Rams_0-1682415073274.png

 

gz
Contributor III
Contributor III
Author

My below output is like this, i don't see date 

gz_1-1682498868281.png

 

Rams-
Creator
Creator

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.