Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I'm relatively new to Qlik and I currently trying to get a grip on set expressions.
I have this simple expression:
Count(
{$<Leistungskatalog = {"CAT1"}, [Name] = {"*"}> * <FallBewegungKey = {"=Count(ICD) > 0"}>}
DISTINCT Fallnummer)
So in other words I want to get all records which match the CAT1 catalogue AND have a count > 0 of a specific measure while ignore the Name selection (I also tried to nullify by leaving the right side empty).
If I remove the part with the count it's working but as soon as I add the intersection and I select a name, the filter is applied although it should not be.
Count(
{$<Leistungskatalog = {"CAT1"}, [Name Arzt] = >}
DISTINCT Fallnummer)
This works for example. Any hints on what I am missing?
If you want to ignore the Name selection you need to apply this ignoring to all parts like:
Count(
{$<Leistungskatalog = {"CAT1"}, [Name]> * <FallBewegungKey = {"=Count(ICD) > 0"}, [Name]>}
DISTINCT Fallnummer)
or more simple:
Count(
{$<Leistungskatalog = {"CAT1"}, [Name], FallBewegungKey = {"=Count(ICD) > 0"}, [Name]>}
DISTINCT Fallnummer)
or in a more logical way like:
if(Count({< [Name] >} ICD) > 0,
Count({$<Leistungskatalog = {"CAT1"}, [Name]>} DISTINCT Fallnummer))
or in further optimized way like:
sign(Count({< [Name] >} ICD)) *
Count({$<Leistungskatalog = {"CAT1"}, [Name]>} DISTINCT Fallnummer))
Beside of this you might be also able to skip the count() part if no ICD records exists or they have the wrong respectively unwanted values - but this would depend on the dataset and the data-model if and how it might be possible.
Hi Marcus,
first, thanks for your answer - ignoring the name in all selections makes sense, so I added the name filter to the second set aswell - but it still doesn't work.
But what works is if I also put the filter inside the nested count like this:
Count(
{$<Leistungskatalog = {"CAT1"}, [Name] = > * <FallBewegungKey = {"=Count({$<Name = >} ICD) > 0"}, [Name] = >}
DISTINCT Fallnummer)
Is this normal / expected behaviour in Qlik Sense?
Yes, this is the expected behaviour and it is related to the order of the execution and in which context they are performed. If by the count of ICD a certain selection should be ignored/overwritten this condition must be included in the inside of the expression and depending on view-requirements it might be included within all other stages of the calculation, too.