Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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..
Year filter should not affect the chart?
No it shouldnt. In my actual dashboard I have other KPIs it will affect but not the trend
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..
Thanks arulsettu!