Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Value field does not give same filtering capability as regular measures

Hi Community,

I have created a value list that will allow me to show two measures on a grouped bar chart. I have used Qliksense sample data to explain the issue.

I have a field to toogle between average and total called 'Aggregation'. I also have a year filter and 2 measures - one for CO2 emissions and other for agriculture.I do not want my year filter to affect the view and it does not affect in Chart1 where I simply added multiple measures, but in chart 2 where i used a value list, the year filter affects my chart.

Attaching the sample qvf. Let me know where I am wrong.

Also, I can implement this functionality using multiple measures but if I use a value list I can easily use custom colors.

If I use chart 1 I have to load a inline script and further complicate the Chart by adding an additional condition.

1 Solution

Accepted Solutions
arulsettu
Honored Contributor III

Re: Value field does not give same filtering capability as regular measures

Hi,

     replace the measure with this

if(Only({<Year=>}valuelist('A','B')) = 'A',

     if (Only({<Year=>}Aggregation)='Totals', Sum({<Year=>}[CO2 emissions (metric tons per capita)]),

     if (Only({<Year=>}Aggregation)='Average',Sum({<Year=>}[CO2 emissions (metric tons per capita)])/count({<Year=>}Country), Sum({<Year=>}[CO2 emissions (metric tons per capita)]))),

    

if(Only({<Year=>}valuelist('A','B')) = 'B',

              if (Only({<Year=>}Aggregation)='Totals', Sum({<Year=>}[Agriculture, value added (% of GDP)]),

              if (Only({<Year=>}Aggregation)='Average',Sum({<Year=>}[Agriculture, value added (% of GDP)])/count({<Year=>}Country),  Sum({<Year=>}[Agriculture, value added (% of GDP)])))

     )

)

it works for me..

4 Replies
arulsettu
Honored Contributor III

Re: Value field does not give same filtering capability as regular measures

Year filter should not affect the chart?

Not applicable

Re: Value field does not give same filtering capability as regular measures

No it shouldnt. In my actual dashboard I have other KPIs it will affect but not the trend

arulsettu
Honored Contributor III

Re: Value field does not give same filtering capability as regular measures

Hi,

     replace the measure with this

if(Only({<Year=>}valuelist('A','B')) = 'A',

     if (Only({<Year=>}Aggregation)='Totals', Sum({<Year=>}[CO2 emissions (metric tons per capita)]),

     if (Only({<Year=>}Aggregation)='Average',Sum({<Year=>}[CO2 emissions (metric tons per capita)])/count({<Year=>}Country), Sum({<Year=>}[CO2 emissions (metric tons per capita)]))),

    

if(Only({<Year=>}valuelist('A','B')) = 'B',

              if (Only({<Year=>}Aggregation)='Totals', Sum({<Year=>}[Agriculture, value added (% of GDP)]),

              if (Only({<Year=>}Aggregation)='Average',Sum({<Year=>}[Agriculture, value added (% of GDP)])/count({<Year=>}Country),  Sum({<Year=>}[Agriculture, value added (% of GDP)])))

     )

)

it works for me..

Not applicable

Re: Value field does not give same filtering capability as regular measures

Thanks arulsettu!