Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi all,
I would like to show a position line (in a bar chart) even if multiple values are selected within a filter.
Currently I use following logic:
=if(Land='Poland' and [Object classification]='Shoppingcenter' and [Year of Construction]<=2020,215,'')
However, once I select more than one value in a filter within "Year of Construction", e.g. 2019 and 2020, the position line does not appear anymore.
Many thanks for your help!
*Attached you can find the Qlik example
Your field-reference is an only() function and if more as one value exists the result is NULL and with it of course the entire calculation. Instead of this you may try it with something like this:
sum({< Land={'Poland'}, [Object classification]={'Shoppingcenter'}, [Year of Construction] = {"<=2020"}>} distinct 215)
The difference is that the position line is appearing now, which is good, however, the value is 0 and not 215.
This means that the expression didn't return an invalid result anymore like the NULL before. The zero-result now hints for a not existing combination of the conditions - neither existing in their combination and/or any typo or syntax issue and/or a mismatch of values between the field-values and the condition (for example if the year-field contained a string but the condition queries a number).
I suggest you putt the expression in parts at first with a table-chart to see which one are working and returning the expected results.
I tried to reduce it to different single values / filters (put the expression in parts) but nothing seems to work. Maybe it is easier to extend the data model with a table and their values (e.g. 215), and then reference the position line to that data table...