Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
paulyeo11
Valued Contributor II

SET expression how to change from Sum to Average ?

Hi All

I have the SET expression as below :-

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

it display Average stock amount  600 is wrong. I need it display average of Jan and Feb and Mar 2015 stock amount 600/3=200.

What i need it when i click on month = Jan , it will display  100

What i need it when i click on month = Feb , i want it will display 150

What i need it when i click on month = Mar , i want it will display 200

May i know how to modify the expression ?

Enclosed my QV Doc

Paul

1 Solution

Accepted Solutions

Re: SET expression how to change from Sum to Average ?

Hey Paul,

I think it is doing it if you just change your expression to avg, instead of sum

=Avg({$<year = {$(=max(year))}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>} (STK_AMT)/1000)


Best,

Sunny

4 Replies

Re: SET expression how to change from Sum to Average ?

Hey Paul,

I think it is doing it if you just change your expression to avg, instead of sum

=Avg({$<year = {$(=max(year))}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>} (STK_AMT)/1000)


Best,

Sunny

Re: SET expression how to change from Sum to Average ?

Here is your applications also with that change (PFA)

HTH

Best,

Sunny

paulyeo11
Valued Contributor II

Re: SET expression how to change from Sum to Average ?

Hi sir

Thank you very much , it work fine now.

Paul

Re: SET expression how to change from Sum to Average ?

Great, I am glad it worked for you.

Best,

Sunny

Community Browser