3 Replies Latest reply: Jun 26, 2018 9:18 AM by Nadia BERCHANE RSS

    Associations

    Nadia BERCHANE

      I m quite new the qlik sence. I have tow associated tables A and B which have a common field Email

      In a measure I want to do a count only on the emails of table A . I want the equivalent of this sql statement Select A.Email.

      When I set the association between the tow table i can't distinguish between the emails of table A and the emails of table B

        • Re: Associations
          Mark Ritter

          If there is no way to distinguish which table they came from then you have a couple of choices.

           

          Change the field name in one of the tables so that they don't associate.  Then you can create separate tables displaying each tables data. Of course they will not automatically associate if you also need to do other things with the data.

           

          Or you could create a new field in the load with a value of A or B that would then allow you to filter in the app for emails from each table.  This would give you both the association as well as the ability to filter the tables.

          • Re: Associations
            omar bensalem

            add a flag in each table:

             

            Table1:

            load email,

            field1,

            field2,

            'Table1' as Flag1

             

            from source1;

             

             

            Table2:

            load email,

            fieldA,

            fieldB,

            'Table2' as Flag2

             

            from source2;

             

            Now, if u want to count the email of table1 :

            count({<Flag1={'Table1'}>}email)

             

            Now, if u want to count the email of table2 :

            count({<Flag2={'Table2'}>}email)

            • Re: Associations
              Nadia BERCHANE

              I tried the proposed solution  but it gives me an error in the script editor. here is my data model . I want to calculate the ratio between the count of the emails of table A and the emails of table B modèle de données.PNG