4 Replies Latest reply: Jan 13, 2018 1:32 PM by Anibal Martinez-Sistac RSS

    Create table from Data Load Editor based in conditional selections of previous tables

    Anibal Martinez-Sistac

      I will simplify my question to understand it easier: I have a table called "Stores" defined by the following Qlik Code in Data Load Editor:

      Stores:

      Load * inline

      [

      id, sales, id_session, coupon

      1a, 3, 1, true

      2a, 1, 1, true

      3a, 2, 1, false

      1b, 3, 2, true

      1c, 4, 3, false

      ];

      Graphically:

      idsalesid_sessioncoupon
      1a31true
      2a11true
      3a21false
      1b32true
      1c43false

       

      I have a second table called "Sessions" loaded in Qlik through my code:

      Sessions:

      Load * inline

      [

      id_session, sum_sales,

      1, 6,

      2, 3,

      3, 4,

      ];

      Graphically:

      id_sessionsum_sales
      16
      23
      34

       

      And what I want to create is a new table called Results that is a modification of table "Sessions" where the column "sum_sales" is replaced by new 2 columns ("sum_with_coupon" and "sum_without_coupon") whose value depends on the value true or false of the column "coupon" of table "Stores".  This means that the sum of "sum_with_coupon" and "sum_without_coupon" in each row of table "Results" (id_session=X) must match the value of Sum(Sales) where id_session = X  in table "Stores". I know how to do it in a table generated through "Table" in Qlik Sense charts and adapting the metric. What I would like to do is generating the table in the Data Load Editor, pior to working with it through visualzations menu. Thanks in advance for your help. Anibal

       

      id_sessionsum_with_couponsum_without_coupon
      142
      230
      304