Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
pgrs4219
Contributor III
Contributor III

How to display the average of 3 months using set analysis?

Hi Community,

i have a requirement that i need to display the averages for 3 months 6 months and 12 months which includes the current month. i found the following formula in the community is


=avg({<YearMonth ={">=$(=date(addmonths(date#('$(vYearMonth)','MMM-YYYY'),-11),'MMM-YYYY')) <=$(=date#('$(vYearMonth)','MMM-YYYY'))"}, Year=,Month=>} Sales)


I have modified my formula according to above one But, in my environment i don't have year field to do the following change.  Year=,Month.


This is my formula: Here what should i keep in the place of  'Year=,Month'

=avg({<Month End Date ={">=$(=date(addmonths(date#('$(vMonthEndSelected)','DD MMM YY'),-11),'DD MMM YY')) <=$(=date#('$(vMonthEndSelected)','DD MMM YY'))"}, Year=,Month=>} Sales)


vMonthEndSelected:

=date(max(Month End Date),'DD MMM YY')


please can some help me with this.

Thanks


3 Replies
sunny_talwar

Try this:

=Avg({<[Month End Date] ={"=MonthStart([Month End Date]) >= AddMonths(Max(TOTAL [Month End Date]), -11) and MonthStart([Month End Date]) <= Max(TOTAL [Month End Date])"}>} Sales)

pgrs4219
Contributor III
Contributor III
Author

Hi Sunny,

Thanks for your reply,Its not working sunny.

sunny_talwar

Would you be able to provide a sample