Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
imallears
Contributor
Contributor

Can I have an expression in a chart that can both sum and average

Hi, Can I have an expression in a chart that can both sum and average depending on selection? I'm currently using two charts, one hidden which uses if(sum when a certain selection (user) is made.

The issue I'm having is when the user selection is chosen first it jumps to the hidden chart which has the sum expression is used when indeed I need the average chart displaying.

Thanks!

5 Replies
Kushal_Chawda

try this expression

if(getselectedcount(YourField1)>=1, Sum(Amount),

if(getselectedcount(YourField2)>=1, Avg(Amount),Sum(Amount)))

swuehl
MVP
MVP

You can also look into using a single chart with conditional expressions, i.e. you would create multiple expressions and enable 'Conditional' with a condition set like

=GetSelectedCount(FIELD)>0

resp.

=GetSelectedCount(FIELD)=0

I believe using conditional expressions. QV won't need to calculate both aggregations, the sum and the average when only one is needed.

MarcoWedel

Please post a sample application

Thanks

Regards

Marco

MarcoWedel

If you want user dependent expressions then OSUser()='some name' might work as condition.

trdandamudi
Master II
Master II