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

Avg sales of Last 4 months

Hi,

I have a calendar and a sales table,

In my chart I want to show the, Current Year Sales, Previous Year Sales and the avg sales of the last four months of the current year?

I also have a Year and month filter.. How can I do this??

Thank you!

5 Replies
perumal_41
Partner - Specialist II
Partner - Specialist II

Hi

Try this Expression

avg({<Datefiled={'>=$(=Date(addmonths(max(Datefiled),-4)))<=$(=Date(Max(DateField)))'}>}Amount)

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=Sum({<DateFieldName={'>=$(=MonthStart(AddMonths(Max(DateFieldName), -4)))<=$(=Max(DateFieldName))'}>} Sales)/4

Hope this helps you.

Regards,

Jagan.

v_iyyappan
Specialist
Specialist

Hi,

     Try this expression

     = Sum({<TodayNum={'>=$(=(Num(AddMonths(Today(),-4))))<=$(=(Num(Today()))'}>}Sales))

where TodayNum = Num(Today()) / 4

Hope its useful for u.

Regards,

Iyyappan

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Try this

Current year=Sum({<Year={'$(=Max(Year))'}>} Sales )

Previous year =Sum({<Year={'$(=Max(Year)-1)'}>} Sales )

Average sales of last four months =Sum({<Date={'>=$(=MonthStart(Max(Date), -4))<=$(=Max(Date))'}>} Sales)/4

Instead of Max(Date) you can use today()..

Hope this helps you.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try the updated expressions, which ignores the Year and Month dimensions.

Current year=Sum({<Month=, Year={'$(=Max(Year))'}>} Sales )

Previous year =Sum({<Month=, Year={'$(=Max(Year)-1)'}>} Sales )

Average sales of last four months =Sum({<Month=, Year=,Date={'>=$(=MonthStart(Max(Date), -4))<=$(=Max(Date))'}>} Sales)/4

Regards,

Jagan.