Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
AlbertNP90
Contributor
Contributor

Special rounding percentages

How can I define this logic in a QlikSense pivot table? 

Percentages special rounding
Basically, values are rounded to match 100%.

  1. All values are rounded down.
  2. Identify how much percentage points are missing to match 100% in total.
    E.g.: if the down rounded values are 97%, then 3 points have to be distributed.
  3. The percentages with the biggest decimal part (value after the comma) get the extra points.

E.g.:

       Satisfied: 26.98%,

       Fairly satisfied: 24.78%,

       Not very satisfied: 25.7%,

       Not at all satisfied: 22.54%

           26 + 24 + 25 + 22 = 97 -> 3 extra points. To be assigned to the 3 percentages with higher decimal part:
           27 + 25 + 26 + 22 = 100

 

Thank you very much

Labels (4)
1 Reply
brunobertels
Master
Master

Hi 

I assume you have somethink like this : 

brunobertels_0-1658495726573.png

then the trick here is to rank the value then if rank = 4 use floor() function if not then use round  () function like this 

if(aggr(rank(total result), type)='4',floor(sum(result),'0,01'),round(sum(result),'0,01'))

see below table : 

brunobertels_1-1658495888158.png

 

hope it helps