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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to retain Numeric format (e.g. 0.00 or 0.000000000) during load and calculations

How can I force QlikView to retain the numeric format of data it is loading instead of changing it?

I am trying to load amount fields (2 decimal places) and do some calculations with them.

Most of the time this works, but in some instances QlikView is changing the format of the number.

For instance, instead of keeping   30.36,  it is coming in as 30.3599999999997.

This is throwing off all the calculations - and when I try to do a check to see if two numbers match they don't.

Strangely, even if I round the numbers first, they are not matching.

I am sure I am missing something simple.

Help!

Labels (1)
5 Replies
Not applicable
Author

Please try with Num function like below:

Num(11.296 , '###0.00')  --> Num function automatically rounds the value into decimals as you mentioned.

Load Num(Amout,'###0.00') AS Amout,

        Num((Amount * Units) ,'###0.00') AS NetSaleAmount

From Source;

Not applicable
Author

Okay I did get Round to work, but had to put it on each numeric field in the calculation - as well as outside the entire calculation.

There must be an easier way!


Not applicable
Author

Just outside of entire calculation.

Not applicable
Author

Hello,

try something like this:

MyTable:

Load *,

        Amount * Rate as AmountOK;

Load

      Num(Amount,'#,##0.00') as Amount,

      Num(Rate, '#,##0.00') as Rate

From Table1;

or to be sure  

MyTable:

Load *,

        Num(Amount * Rate,'#,##0.00') as AmountOK;

Load

      Num(Amount,'#,##0.00') as Amount,

      Num(Rate, '#,##0.00') as Rate

From Table1;

but I think the first option works.

Best Regards.

Josh_Good
Employee
Employee

You can set the numeric formatting for any field by going to Setting -> Document Properties and selecting the Number tab.  This will set the formatting for the entire document (except when it is overridden at the object or expression level)