Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to plot average sales by year ?

Hi All

I have chart 1 using below expression , working fine all the time :-

money(

sum({$<year = {">=$(=max(year),4)"}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>}$(ColumnDim51)/$(Columndim89)/1000)

, $(vMoneyFormatK))

May i know how to convert it so that it will display average sales by year.

Note that 2016 only have 4 month and 2015 have 12 month. How to automatic adjust ?

2015 should display 347/12= 28.9

2016 should display 104/4 = 26

Paul

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Money(

Sum({$<year = {">=$(=max(year),4)"}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>}$(ColumnDim51)/$(Columndim89)/1000)/Count(DISTINCT {<date = {"=Sum(sales) > 0"}>} month)

, $(vMoneyFormatK))

View solution in original post

3 Replies
paulyeo11
Master
Master
Author

My QV Doc

sunny_talwar

May be this:

Money(

Sum({$<year = {">=$(=max(year),4)"}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>}$(ColumnDim51)/$(Columndim89)/1000)/Count(DISTINCT {<date = {"=Sum(sales) > 0"}>} month)

, $(vMoneyFormatK))

paulyeo11
Master
Master
Author

Hi sunny

Wow the below expression very powerful :-

Count(DISTINCT {<date = {"=Sum(sales) > 0"}>} month)


Thank you.


Paul