6 Replies Latest reply: May 8, 2016 12:28 PM by Steve Br. RSS

    Dividing values

    Steve Br.



      I have a data file about production and two of the columns are time (minutes) and cost. It also contains info about plants, workers, etc. I would like to include a KPI that shows the cost per minute and changes when I select different plants on my visualization. So I need to divide cost by time but I have no idea how to include this as a measure. The values are non-integer. Can anybody help me out here please?





      PS: I am only using Qlik Sense for two days now, so please keep in mind that I'm a total noob.

        • Re: Dividing values
          Stefan Wühl

          One of the first thing to learn in Qlik is how to handle date and time values.


          Please have a look at

          Data Types in QlikView

          Get the Dates Right

          Why don’t my dates work?


          If you are looking at time always in terms of minutes, you could interprete / transform your time field so that it shows a numeric value in minutes. If it's currently a text value like '05:30', maybe like



               Interval#(TIMEFIELD, 'mm:ss')*24*60 as TimeInMinutes,


          FROM ...;


          Then you can use a KPI expression like


          =Sum(COSTFIELD) / Sum(TimeInMinutes)


          to get the average cost per minute

            • Re: Dividing values
              Steve Br.

              Thank you for your answer!


              The time is shown in minutes so i don't need this LOAD expression, right? Just for future reference, where exactly should It be entered. And is there an easier way adjust settings like this, e.g. something like the format cells feature in Excel?


              Now back to my question. When I enter =Sum(Cost) / Sum(Time) as an expression in the KPI filed Add measure, I get an error saying: Error in expression: ')' expected. Don't know what is wrong.

              btw. the data looks like this:


              Plant | Worker | Time      | Cost

              Pl.1   | W1       | 150        | 77,8

              Pl.1   | W2       | 176        | 83,2

              Pl.1   | W3       | 147        | 82,2 

              Pl.2   | W4       | 119        | 90,6


              Pl.35  | W453  | 155        | 67,8



              Thanks again and sorry for the lame questions.