9 Replies Latest reply: Jul 4, 2018 7:02 PM by Sunny Talwar RSS

    Sum function in Qlik Sence data editor does not work

    Victor Xaby

      Dear Qlik-Community,

       

      I am new in Qlik Sence and have a major problem with the sum-function in the Qlik Sence data editor.

       

      I have the following (sample) data set…

       

        

      ORDER_IDUNIT_PRICEQUANTITY
      1024834,85
      1024918,69
      102507,710
      1025016,815
      1025116,820
      1025264,840
      102531020
      102543,615
      1025515,220
      1025626,215
      1025735,125
      1025825,66
      10259810
      102601221
      1026114,420
      1026230,42
      10263836
      102647,725
      1026531,230
      1026630,412
      1026714,750
      1026827,84
      10269260

       

      With the columns “unit_price” and “quantity” I am able to create a new column called “revenue” (unit price * quantity). The result Looks like this:

      result1.png

      (This is just a small extract!)

       

      Know I would like to calculate the share of revenue (revenue / sum[revenue]) for every "order id".

       

      This is my (not working) Code…

       

      LOAD

          ORDER_ID,

          UNIT_PRICE,

          QUANTITY,

         

          UNIT_PRICE*QUANTITY AS REVENUE,

         

          (UNIT_PRICE*QUANTITY)/Sum(UNIT_PRICE*QUANTITY) AS SHARE

         

      FROM [lib://Daten/order_details_3.csv]

      (txt, codepage is 28591, embedded labels, delimiter is ';', msq);

       

       

      I am not sure if this sort of calculation is even possible in Qlik Sense, but if you have an idea or a code for my problem, please let me know.

       

      Thanks for your time!