Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I’m trying to find a way to avoid a standard Qlik Sense behavior related to selections in a table.
I have a column with the following expression:
=If([Flag] <> 1, [Field X])
When a user clicks on a value in this column (so effectively on [Field X]), Qlik Sense correctly applies a selection on [Field X], but it also automatically applies a selection on the field [Flag], since that field is used inside the IF condition.
Something that in my case is not desired.
My goal is: when the user selects a value from the X column, Qlik Sense should only select [Field X] and NOT [Flag].
I already tried hiding the field using HidePrefix, but Qlik Sense still applies the selection on [Flag], and since the field is hidden, I can't even see the selection to remove it.
So my question is:
Is there any way, or any workaround, to prevent Qlik Sense from applying selections on fields used inside the IF expression when the user clicks a cell in the table?
Any suggestion or workaround is appreciated.
Thanks!
Hi @luissss
I think the cleanest option is that you build the new field in the backend, like this:
LOAD
FieldX,
Flag,
If(Flag<>1, FieldX) as FieldX_Display
FROM ...
There are other options like using calculated dimensions with aggregates or using alternate states, but they don't deliver the same good results.
Kind Regards
Daniel
Hi, and thanks for your reply!
Unfortunately, I can’t move this condition to the data load script.
The logic behind the IF expression is a bit more complex and depends on runtime factors that I can’t easily reproduce or pre-calculate in the backend. For this reason, generating a static FieldX_Display during the load isn’t an option in my case.
That’s why I’m looking for a frontend workaround that prevents Qlik Sense from applying the selection on Flag when the user clicks the table cell.
If you have any alternative ideas that can work without modifying the data model, I’d be happy to try them.
Thanks again!
You may try:
[$(=If([Flag] <> 1, 'Field X'))]
Hi @luissss
Try this expression then. It seems to work on my end:
=Aggr(Only({<Flag-={1}, [Field X]= >} [Field X]), [Field X])
Kind Regards
Daniel