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

How to make sum of averages?

Hello,

I have this measure that makes averages of value for the rows where Source is AAA, BBB, CCC, and now I need to make the sum of all these 3 averages on a new row in the same pivot table.

if(match(Source,'AAA','BBB','CCC'),
Num(Avg({<Source={'AAA','BBB','CCC'}
,
Help_Column={'DDD'}>}[Value]), '#,##0', '.', ','))

Any idea how can I do this?

Labels (2)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

the  IF() seems redundant as the set analysis already filters for those SOURCE values

 

=Num(

SUM ( AGGR ( 

Avg({<Source={'AAA','BBB','CCC'},Help_Column={'DDD'}>}[Value]) ,   DIMENSION1 , DIMENSION2, ...... )  )

, '#,##0', '.', ',')

 

DIMENSION1 , DIMENSION2 ..   are the dimensions used in your chart

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

3 Replies
ogster1974
Partner - Master II
Partner - Master II

Use the the AGGR() Function to sum the averages at the higher level of granularity.

sum(Aggr(if(match(Source,'AAA','BBB','CCC'),Avg({<Source={'AAA','BBB','CCC'},Help_Column={'DDD'}>}[Value]), Source)))

vinieme12
Champion III
Champion III

the  IF() seems redundant as the set analysis already filters for those SOURCE values

 

=Num(

SUM ( AGGR ( 

Avg({<Source={'AAA','BBB','CCC'},Help_Column={'DDD'}>}[Value]) ,   DIMENSION1 , DIMENSION2, ...... )  )

, '#,##0', '.', ',')

 

DIMENSION1 , DIMENSION2 ..   are the dimensions used in your chart

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
BogdanT18
Contributor III
Contributor III
Author

Thank you both for the help!