Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Total sum of last 3 years per ordernumber

Hi,

I made a straight table and need to know the total sum of the sales of the past 3 years per ordernumber and hope you are able to help me.

Example:

Ordernummer = 1

Sales per year:

2018 = 80

2017 = 50

2016 = 70

Total of last 3 years for this order = 200

I made a variable for the last 3 years: vLast3Year = Year(YearStart(Today(),-2))

And the expression:

Sum({$<Year={'>=$(vLast3Year)'}>} total(sales) )

When I select the ordernumber the total sum amount of the last 3 years is correct and visible per year:    

YearOrder numberSalesTotal sum Last 3 Year
2018180200
2017150200
2016170200
2015160200
2014190200

However, when I select all orders per year, then the total is the sum of all ordernumbers of the past 3 years, instead per ordernumber (it should be the data in green):

   

YearOrder numberSalesTotal sum Last 3 YearTotal sum Last 3 Year
20181802450200
201822002450700
20183202450100
2018450024501200
201851002450250

   

Thanks in advance.

Regards,

Marielle

   

 

Het bericht is bewerkt door: Marielle Kandt

Het bericht is bewerkt door: Marielle Kandt

1 Solution

Accepted Solutions
sunny_talwar

Try this

Sum({$<Year = {'>=$(vLast3Year)'}>} TOTAL <[Order number]> sales)

View solution in original post

2 Replies
sunny_talwar

Try this

Sum({$<Year = {'>=$(vLast3Year)'}>} TOTAL <[Order number]> sales)

Anonymous
Not applicable
Author

Yes it is working! Thanks for your support.