5 Replies Latest reply: Jan 17, 2018 10:31 AM by Petter Skjolden RSS

    Calculate using 'only'/'distinct'

    Kenneth Andersen

      I have a set of data with respondents choosen a city the like to visit.

       

      Every respondents has an ID and a weight which I'mt using for calculation.

       

      The data file look like this ( and the results I like to produce in Qlik at the bottom):

      Udklip.JPG

      I like to measure how in percent as choosen City A, City B ect. - but only out the ID's who has choosen a city.


      I have done the calculation at the bottom: 2.9 hos choosen City A (the wieght added up from ID 1, 2 and 3). Using this Expression I can calculate the number in qlik sense:

       

      =Sum(Aggr(Only([weight]), Uniq_ID))

       

       

      So far so good. But how do I calculate the total weight from the ID who has choosen a City (when that is done I can measure the % as I like). Id 5 will not qualify as he hasn't choosed any city. Therefor the total should be equal 3.4.

       

      But how do I make the right expression?