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: 
mkudis
Contributor II
Contributor II

Calculating previous years sales based on selected date range

I am currently getting the Sales (ext_sell) and Cost (ext_cost) information for a selected date range from a list box, working just fine as expected using the below expressions:

sum({$ <group_id={XYZ}, Product_Type={All} >} ext_sell)

sum({$ <group_id={XYZ}, Product_Type={All} >} ext_cost)

 

How would I maintain the set expressions while adding in a prior year expression so that if I selected Jan-2022 thru Dec-2022 in my Date Range list box, I could have the sales and cost information returned for Jan-2021 thru Dec-2021?  The date range list box is using a field name Month_Year.

 

Labels (2)
2 Replies
settu_periasamy
Master III
Master III

Hi, 

If Month_Year  field is a date format, Try like below

sum({$ <group_id={XYZ}, Product_Type={All},Month_Year={'>='&AddMonths(Date#(Min(Month_Year),'MMM-YYYY'),-12) &'<='&AddMonths(Date#(Max(Month_Year),'MMM-YYYY'),-12)} >} ext_sell)

mkudis
Contributor II
Contributor II
Author

That formula is giving me an error at the end part -

} >} ext_sell)

Looks like the error is: Error in set modifier ad hoc element list: ',' or ')' expected

 

Trying to play around with it but can't figure it out.