Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
rohitraturi
Contributor II
Contributor II

Need to Calculate Previous Year Charge Amount

I need to calculate the charge amount for the previous year. I am using the following formula but it's not working. Can somebody help me out?

Sum({<Corrected ={'N'}, year(posting date)= {$(=year(posting date) - 1)}>} Amount)
-
Sum({<Corrected ={'Y'},year(posting date)= {$(=year(posting date) - 1)}>} [Amount])

Labels (1)
3 Replies
ecolomer
Master II
Master II

Hi,

You can try the following:

Define a variable
      LastYear = Year (PostingDate) -1

and change the expression like this:
  

Sum({<Corrected ={'N'}, Year (PostingDate) = $ (LastYear))}>} Amount)
-
Sum({<Corrected ={'Y'},Year (PostingDate) = $ (LastYear)}>} [Amount])

 

rohitraturi
Contributor II
Contributor II
Author

It gives me an error with the syntax. Not working.
ecolomer
Master II
Master II

OK, try this:

Sum({<Corrected ={'N'}, Year (PostingDate) = {$ (LastYear)}>} [Amount])
-
Sum({<Corrected ={'Y'},Year (PostingDate) = {$ (LastYear)}>} [Amount])