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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
chhavi376
Creator II
Creator II

Rounding off to an integer using NUM

I was trying to round off all my numbers to integer but i came across this problem:

if i use '#,##0.00'  in num, i get these numbers:

Untitled.png

When we round this off, it should ideally be 16, 27 and 35

But when i use '#,##0'  in num, i get these numbers:

1.png

37 Replies
chhavi376
Creator II
Creator II
Author

I checked that Sunny,

But it doesnt work.

saimahasan
Partner - Creator III
Partner - Creator III

You can also use Round function:

Round(FieldName)

oknotsen
Master III
Master III

What you seem to be doing is using a format to show the numbers. That has nothing to do with actual rounding the numbers.

Example:

15 will still show as 15.00000 if you use a format as '0.00000'

To round something, you will need to use the round() function (and yes, it actually works if you use it correct). For example:

15.496 used with round() trying to round it to whole numbers would look like round(15.496, 1).

Please note that round works slightly different in Qlik as it does in XLS or many programming languages. Round() in Qlik works with "steps of". So rounding in two decimals would look like round(15.496, 0.01)

May you live in interesting times!
chhavi376
Creator II
Creator II
Author

Saima,

Ceil rounds up,

i want it to round as per the logic:

number >= x.5 gives me x+1

and number <x.5 gives me x.

Round() is also giving wrong results

chhavi376
Creator II
Creator II
Author

Onna,

You are right.

But Round is giving me these results:

my numbers from the reporting tables were 15.5, 26.5 and 34.5

but when i round them, i get 15,27 and 35

sunny_talwar

I guess the point of the article was that the behavior you are seeing is because of the rounding issue. You can try this

=Round(Round(Number, 0.1)), but this will not work perfectly as well.

Using the above code, you should get these

13.50 -> 14

13.46 -> 14

13.44 - > 13

saimahasan
Partner - Creator III
Partner - Creator III

can you please upload your QVW

gautik92
Specialist III
Specialist III

for this round() should work

can yu share the script

Not applicable

Can you share the code where you using, so that we can help you

chhavi376
Creator II
Creator II
Author

These are the backend values:

Untitled.png

This is the expression i am using:

round(Sum( {<flag={1},Products-= {'Product1'}, Metric_Type={'abc'} >}  Metric_Value_N),1)

This is the output in the table:

1.png