Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

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
sunny_talwar

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

View solution in original post

4 Replies
sunny_talwar

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

sunny_talwar

Here is your applications also with that change (PFA)

HTH

Best,

Sunny

paulyeo11
Master
Master
Author

Hi sir

Thank you very much , it work fine now.

Paul

sunny_talwar

Great, I am glad it worked for you.

Best,

Sunny