Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
kalyandg
Partner - Creator III
Partner - Creator III

Avg(Sales)

How to Calculate Avg of Sales. I have a data for two years, but my requirement is i should calculate avg(sales)

If selection is Current year - 3rd month then take average of 12 months in last year + upto Cur. Year 3rd month = Total 15 months sales average

Please help me to solve this issue, with a briefed expression.

1 Solution

Accepted Solutions
Not applicable

Hi Sundaram

As far as I understood you requirement you could use the following expression with set analysis.

Avg ({1<Date= {'>=$(min({1<Year ={$(=Year-1)}>} Date))<=$(vMax)'}>}Sales) ===

Avg ({1<Date= {'>=$(Previous year min date)<=$(Current month Max date)'}>}Sales)

Attached is a sample QVW

Hope this solves. I have assumed the way you data looks. If you have any specific requirements do let me know.

Thanks

fahad

View solution in original post

7 Replies
Not applicable

Hai Kalyan,

Pls send the datin the form of excel

Regards,

Chandu

Not applicable

Hi Sundaram

As far as I understood you requirement you could use the following expression with set analysis.

Avg ({1<Date= {'>=$(min({1<Year ={$(=Year-1)}>} Date))<=$(vMax)'}>}Sales) ===

Avg ({1<Date= {'>=$(Previous year min date)<=$(Current month Max date)'}>}Sales)

Attached is a sample QVW

Hope this solves. I have assumed the way you data looks. If you have any specific requirements do let me know.

Thanks

fahad

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=Sum({<DateFieldName={'>=$(=YearStart(Max(DateFieldName), -1))<=$(=Max(DateFieldName))'}>}Sales)/RangeSum(12 + Num(Month( Max(DateFieldName))))

Hope this helps you.

Regards,

Jagan.

kalyandg
Partner - Creator III
Partner - Creator III
Author

Hi jagan,

                     Thank you, its working

kalyandg
Partner - Creator III
Partner - Creator III
Author

Hi fahad,

               Thank you very much, its working and i am very clear now

kalyandg
Partner - Creator III
Partner - Creator III
Author

hi fahad,

i have to use both expression or any one

Not applicable

Hi Kalyan

You have to use  the  first expression.

Second is just an illustration.

Thanks

Fahad