Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Contributor II

Round with a fixed digit

Hello all,

I would like to round to the eleventh digit.

I tried the function: Round(Sales,11,0.01). But this is not the expected result.

Please could tell how can I do that.

Many thanks in advance for your help.

 

Labels (1)
1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Re: Round with a fixed digit

You could also use an expression to define the digits of the rounding, maybe with:

= round(14.5489627892171, 1 / pow(10, 😎)

and you could also create a customized function with the help of a variable for it, for example:

eRound:
round($1, 1 / pow(10, $2))

and then calling it with:

$(eRound(14.5489627892171, 8))

- Marcus

View solution in original post

5 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Round with a fixed digit

Try: Round(Sales, 0.00000000001)

- Marcus

Highlighted
Digital Support
Digital Support

Re: Round with a fixed digit

Sou, just providing the Help link for the Round function as well in addition to what Marcus posted.

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/ChartFunctions/...

If you find things are not working per what is documented in the Help, there are only two things I could suggest, check that you are running the latest service release (SR) for the major version you are running, these are:

11.20 SR19

12.10 SR11

12.20 SR9

12.30 SR3

12.40 SR1

If you are on one of those, then this may be something defect related, and will likely be best to open a support case with us at that point, if you can provide an example app if you do that, that should help us check things pretty quickly.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Highlighted
Contributor II

Re: Round with a fixed digit

Hello @marcus_sommer , @Brett_Bleess ,

Thank you both for your help.

@marcus_sommer : Your solution give me the result expected. I wonder if there is a way to optimize the second parameter of the function round(), for example to precise directly the number of decimals. Maybe not with the function round(), but if there is another function in QVW I will be really interesting to know it ?!

@Brett_Bleess : Thank you for sharing the link.

 

Highlighted
MVP & Luminary
MVP & Luminary

Re: Round with a fixed digit

You could also use an expression to define the digits of the rounding, maybe with:

= round(14.5489627892171, 1 / pow(10, 😎)

and you could also create a customized function with the help of a variable for it, for example:

eRound:
round($1, 1 / pow(10, $2))

and then calling it with:

$(eRound(14.5489627892171, 8))

- Marcus

View solution in original post

Highlighted
Contributor II

Re: Round with a fixed digit

Hi @marcus_sommer,

Your solution is great. 

Many thanks for your help.