Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rounding of percentage value

Hi

I have a senario where i have to round the values

the data is as below

country      value       output

a                12.56  %     13 %

b                 10.2   %     10 %

if the value after the point is >= 5 then it should make it as 13

if the value after the point is < 5 then it should make it as 10

Regards

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

You know what you could do is just forget the rounding function and use the integer format in the number tab. That will do the rounding AFTER the accumulation.

View solution in original post

14 Replies
trdandamudi
Master II
Master II

You can use Round function...

Dimension: Country

Expression: Round(value)

Not applicable
Author

Hi tirumala i can use round but the my requirement is different,

if the value after point is >=5 then it should round to the next number

if it is less than 5 then it should round to the same number

Anonymous
Not applicable
Author

Is that not what rounding does?

holmlund
Contributor III
Contributor III

If(frac(value)>=0.5, Round(value), value) or if value is decimal just Round(value, 0.01).

Not applicable
Author

Hi Aron

this is what  i'm getting

can you please help me

Not applicable
Author

the first column is with out rounding and secondone is with rounding

Anonymous
Not applicable
Author

something is going on in that chart that I am not privy to.

If you could create a sample version of this data and upload it here, maybe I can give you a better answer.

trdandamudi
Master II
Master II

Round function works exactly as  you described. I just took few values you provided and it is giving correct results. Please check your expressions or script to make sure you have the correct definition of the fields..

round.jpg

Not applicable
Author

Hi Aron, i'm doing an accumilation to get these percentage values, will  that effect the chart

i'm using the below expression to get the percentage values and acumilating it 10 steps backward

=round(sum({<IsSameMonth={'1'}>}TOT)/sum({<IsSameMonth={'1'}>}total(TOT)) * 100, 0.01)