5 Replies Latest reply: Jul 3, 2014 12:33 PM by Michael Reagan RSS

    Set Analysis Odd Behaviour

    Mike Swinn

      I have a simple set analysis expression to count the number of people who have installed a toolbar as below.

       

      version A: count( {$ <toolbar_downloads.Date = {'*'}>} DISTINCT supporter_id)

      version B: count( {$ * <toolbar_downloads.Date = {'*'}>} DISTINCT supporter_id)

       

      With no filters applied I would expect both to give the same result, and to differ only where filters are applied - version A should ignore filters whereas version B should account for them because it has the *.

       

      However, only version A gives exactly the answer I expect while version B gives a significantly lower number. I tend to opt for the version B in this type of expression as it allows for filters, but I'm quite confused as to why it gives a different result here. Note there are other joined tables with additional supporter_id in them which don't exist in the toolbar table, which is why I'm using the set analysis in the first place.

        • Re: Set Analysis Odd Behaviour
          James Summerson

          I would think that your first expression would be influenced by filters, all values would normally use count({1})?

           

          Also ignoring the date, which I presume the = {'*'} means is normally done by toolbar_downloads=, i.e.

           

          Count({1<toolbar_downloads.date=>} DISTINCT supporter_id)

           

          Am I missing something?

            • Re: Set Analysis Odd Behaviour
              Mike Swinn

              I'm using the {'*'} to get all records that have a download date, rather than ignoring the selection. This is because I have the supporter_id key field in multiple tables, and some of these have many supporter IDs that don't exist in the toolbar_downloads table, so to get the count of users who have downloaded, I'm simply saying where date exists, by using {'*'}

            • Re: Set Analysis Odd Behaviour
              Michael Reagan

              Are you trying to filter within your date field (intersection)? Try putting the * right before the = sign:

               

              count( {$ <toolbar_downloads.Date *= {'*'}>} DISTINCT supporter_id)


              mike

                • Re: Set Analysis Odd Behaviour
                  Mike Swinn

                  Interesting, that works fine. Intersection is indeed what I want, so that if I have other filters of any type applied (including date), these will be taken into account.

                   

                  However, I'm still confused as to why my version with the * before the <> did not work. I occasionally need to place the * operator in between different expressions e.g. <...> * <...> * <...>,  and this works fine. Therefore I'd like to understand what the * before the set analysis expression is actually doing, and why it's giving a different result

                • Re: Set Analysis Odd Behaviour
                  Michael Reagan

                  Hmmmm, I've never used the * before the set before, though like you, between sets works. If you search the community for QlikLearn-Set-Analysis-Presentation.pdf, it may be able to give you some more insight that I don't have...

                   

                  mike