Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mario-sarkis
Creator II
Creator II

Date function

Hey all

If i want to calculate a sum of an amount for max periode date of last year wut expression should i use ?

can anyone help?

8 Replies
sunny_talwar

May be this:

Sum({<Date = {"$(=Date(Max({<Year = {$(=Max(Year) - 1)}>}Date), 'YourDateFieldFormatHere'))"}>}Amount)

Chanty4u
MVP
MVP

sum({<Year={$(=Max(Year)-1)}>} <your field>)

its_anandrjs

Try this

Sum({< [Date Field] = {"$(Addmonths([Date Field],-12 )"  >} SalesAmt )

Regards,

Anand

mario-sarkis
Creator II
Creator II
Author

‌hi sunny thanks for your reply

just a question

if my format date is num it apply the same expression?

sunny_talwar

If its a number, you can try this:

Sum({<Date = {"$(=Max({<Year = {$(=Max(Year) - 1)}>}Date))"}>}Amount)

mario-sarkis
Creator II
Creator II
Author

‌hi sunny

i need to ask you i tried the expression and it shows me a right answer bur the pro is that when i select on year or period it shows me zero you have an idea if its because the expression ?

HOpe you can help

sunny_talwar

Try this to exclude any selection in any other date and time fields:

Sum({<Date = {"$(=Max({<Year = {$(=Max(Year) - 1)}>}Date))"}, Year, Month, MonthYear, Period>}Amount)

mario-sarkis
Creator II
Creator II
Author

thank you for your help this work perfectly ‌