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

Conditional enabling of expressions in line chart in Qlik sense

Hi All,

I have an issue while displaying expressions in Line chart conditionally in qlik sense.

I have two filters (Metric and Display) and Line chart.

The values of Metric is : Sell,Sold,stock

The values of Display is: Quantity,Value1,value2
The Line Chart is having Monthyear as dimension and 3 expressions (Sell,Sold,Stock)
My requirement is when we make a multiple selections in Metric field then chart should show accordingly
Case1:
If we make a selection on Metric filter as sell and Display as Quantity then Line chart should show Sell information,It is working fine
Case2:
If we make a selection on Metric filter as Sell,Sold(two selections)and Display as Quantity then Line chart should show Sell and Sold information
but my chart is showing empty as it supose to show Sell and Sold information, It is not working fine.
THe below expresions are using for Sell and Sold
Sell:
if(Metirc='Sell' and Display='Quantity', Sum(Sell),
if(Metirc='Sell' and Display='Value1',sum(Sell*Price),
if(Metirc='Sell' and Display='Value2', sum(Sell*Net))),'')

Sold:
if(Metirc='Sold' and Display='Quantity', Sum(Sold),
if(Metirc='Sold' and Display='Value1',sum(Sold*Price),
if(Metirc='Sold' and Display='Value2', sum(Sold*Net))),'')

1 Reply
rubenmarin

Hi @venkey2847, when there is more than one value selected in field, if you ask for the field selections without any aggregation function, it will return null. So you need to use an aggregation function to return only one value.

In example you can use Concat() to merge both values in a single value, and use Index() or Substring() to check if the value exists in the string:

If(Index(Concat(Metric), 'Sell'), ....

Note that if there is a value that is a part of another value, like Sell and Selling price you need to add a separator to look for full values:

If(Index(';' & Concat(Metric, ';') &';', ';Sell;'), ....