Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

simonb2013
Contributor

Set Analysis not recognising current filter

I have 1 single table of data in my app.
3 fields of relevance:

  • ShipTo           (A customer number that I am COUNTing)
  • DlvryStatus  (A Status of one of : A,I,T)
  • LBStatus         (A Status of one of : Active, Inactive, T)

Both of those status fields are directly aligned:  A =Active, I=Inactive, T=T

So I wanted to count the ShipTo, that are Active.
Was getting some unexpected results, so now testing this 2 ways :

=Count(distinct {$<DlvryStatus={"A"}>} ShipTo)
=Count(distinct {$<LBStatus={"Active"}>} ShipTo)

Both 'should' behave identically.
Both give a correct count with no selections made in the UI. (they count ShipTo that have 'A' or 'Active')

However, if I filter DlvryStatus="I" , the DlvryStatus expression above still gives a value, even though I have explicitly filtered on value 'I' , and the expression should only count when 'A'.
At the same time, the LBStatus expression now reads '0' (correctly)

This works in reverse also: if I filter LBStatus="Inactive", then the LBStatus expression still shows full value, yet the DlvryStatus expression shows '0'.

Maybe I've been at this too long, but these are simple basic expressions that I am struggling to understand what's going on !!

Attaching a Screenshot:
Top 2 boxes on left are text boxes showing Set Analysis Expression with resulting number.
Top 2 boxes on right are filters for the 2 Status fields (filtered on LBStatus="Inactive")
Bottom Left: straight table
Bottom right :  Pivot showing mapping between the 2 Status Fields.

Really grateful if someone could point out what I am not seeing here !!

Thanks

 

 

1 Solution

Accepted Solutions

Re: Set Analysis not recognising current filter

That is how the syntax is built. and if you are not looking for this behavior, then there is a work around. To use * before = and now it will honor your selection.

 

Count({$<DlvryStatus *= {"A"}>} ShipTo)

 

4 Replies
Partner
Partner

Re: Set Analysis not recognising current filter

if you use set analysis DlvryStatus={"A"} then DlvryStatus is explicitly set i.e. selection of a DlvryStatus does not effect the expression but any other expressions may effect it

Re: Set Analysis not recognising current filter

May be you need this

=Count(DISTINCT {$<DlvryStatus *= {"A"}>} ShipTo)
=Count(DISTINCT {$<LBStatus *= {"Active"}>} ShipTo)
simonb2013
Contributor

Re: Set Analysis not recognising current filter

I hear you, but  confusing/conflicting with the Qlik documentation.

Set Expressions

Example : 

{$<Year={2009}>}

This set expression contains an identifier $, and the modifier Year={2009}. This example does not include an operator. The set expression is interpreted as: "All records in the current selection that belong to the year 2009".

So if I filter on DlvryStatus='I',  using a filter pane, then my 'current selection'  no longer contains any 'A' values.
My set expression :

Count( {$<DlvryStatus={"A"}>} ShipTo)

   should then give me "All records in the current selection that belong to the DlvryStatus 'A'"   
.... and from the previous filter pane action, there are no 'A's to count !

 

Sorry if I'm circling around the same point ... I just don't get the logic of  asking it to count records that match a specific value,  but then it counts them even if they are not in the current set !?

 

 

Re: Set Analysis not recognising current filter

That is how the syntax is built. and if you are not looking for this behavior, then there is a work around. To use * before = and now it will honor your selection.

 

Count({$<DlvryStatus *= {"A"}>} ShipTo)