Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Expression depending on a field value

Hi, I have in a scatter chart a expressions as simple as this:

Sum(Data)

I also have a table (load inline) with 3 values: SalesAmount, Qty, CostAmount

I display this 3 values in a lis box.

My intention is that when I choose one of this value in the list box, the expression of the chart changes into somethig like this:

Sum(SalesAmount)

or

Sum(Qty)

or

Sum(CostAmount)

Any suggestions?

thanks

1 Solution

Accepted Solutions
rubenmarin

Hi, you can use conditional expressions, create 3 expressions, each one with a different condition, ie, supposing the inlite table field is called 'Metric':

Metric='SalesAmount'

Another option is create nested if expression:

If (Metric='SalesAmount', Sum(SalesAmount))

An another option is to use the value of the selected "Metric" as field name for the expression:

Sum($(=Metric))

View solution in original post

4 Replies
rubenmarin

Hi, you can use conditional expressions, create 3 expressions, each one with a different condition, ie, supposing the inlite table field is called 'Metric':

Metric='SalesAmount'

Another option is create nested if expression:

If (Metric='SalesAmount', Sum(SalesAmount))

An another option is to use the value of the selected "Metric" as field name for the expression:

Sum($(=Metric))

Anonymous
Not applicable
Author

Thanks Ruben, the Sum($(=Metric)) option works pretty weel to me.

Not applicable
Author

The Following will work

=sum($(=Only(Field)))

See attached example

Not applicable
Author

hi,

you can try enable condition

and write

if(metric='SalesAmount',1,0)

and then write your respected 

sum(SalesAmount)

with regards

harshita Gaur