Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

What si the use of Num() ?

Hey,

Can anyone tell me the use of NUM() ?

Thanks

13 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

Num

num(expression [ , format-code [ , decimal-sep [ , thousands-sep ] ] ] )

The num function formats the expression numerically according to the string given as format-code. Decimal separator and thousands separator can be set as third and fourth parameters. If the parameters 2-4 are omitted, the number format settings that have been specified with the Number Interpretation Variables are used in first hand, in second hand the operating system number format settings are used if number interpretation variables have not been set.

Example:

The examples below assume the two following settings:

    

Default setting 1

Default setting 2

Number format

# ##0,#

#,##0.#

num( A, '0.0' ) where A=35648.375 returns:

    

Setting 1

Setting 2

String

35 648 375

35648.375

Number

35648375

35648.375

num( A, '#,##0.##', '.' , ',' ) where A=35648 returns:

    

Setting 1

Setting 2

String

35,648.00

35,648.00

Number

35648

35648

num( pi( ), '0,00' ) returns:

    

Setting 1

Setting 2

String

3,14

003

Number

3.141592653

3.141592653

anbu1984
Master III
Master III

Num() formats numeric input based on format code provided to this function. Check the manual for examples

nikhilgarg
Specialist II
Specialist II
Author

I have already gone thru this but can you plz give an example.

thanks

Not applicable

Hi,

If u wish to display number in a particular format in a straight table, you can directly use

number tab:

number format settings.

But in case of text object you say wish to display share as 70.0%,

you can use num(your expression,'#,##0.0%').

Thanks

Khushboo

Not applicable

Hi Nikhil,

have a look at this, should help

On Format Codes for Numbers and Dates

Joe

jpenuliar
Partner - Specialist III
Partner - Specialist III

The help item has already provided a few good examples.

try on a textbox object,

=num(35648,'###,###') result : 35,648

=num(35648,'###,###.##') result 35,648.00

nother example is when you apply Num() to a Date field.

nikhilgarg
Specialist II
Specialist II
Author

I ahve a expressn as :

Date(Floor(Num(Logdatetime)), 'MM/DD/YYYY')

where Logdatetime is : 31/03/2015 10:10:50 am

Is this not applicable here ??

jpenuliar
Partner - Specialist III
Partner - Specialist III

The best way to understand the expression is to break it down.

we see here 3 functions nested.

try Num(Logdatetime) to see how the results are

jpenuliar
Partner - Specialist III
Partner - Specialist III

if I put in textbox the below:

=num('31/03/2015 10:10:50 am')

the result will be:

42094.424189815