Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use Decimal seperator

Hi All,

         I have a calculation value 2.951885674 i want to limit this value 1 digit/2digits after decimal like 2.9 and 2.95...how can we do this..

6 Replies
sivarajs
Specialist II
Specialist II

num('2.958885674','#.##')

sujeetsingh
Master III
Master III

Just go to  Properties<<<<Number<<<<

and then you can select Fixed to option in Number Format Setting and choose the Decimals..

You can also check other options for your better knowledge..

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You did not say whether you wanted to change the display format or the number itself. num(2.958885674,'#.##') changes the display format, but not the underlying value. To change the number, use round(2.958885674, 0.01).

To illustrate

          num(2.958885674,'#.##') <> num(2.9580000,'#.##')

but

          round(2.958885674, 0.01 = round(2.9580000, 0.01)

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thnx for your replies.   Jonthan its just for display My  actual values is 2.9518876433449 if i use num(2.9518876433449, '#.##') its giving exact value i.e 2.95 but if u use num(2.9518876433449, '#.#') it giving 3.0 but my expected values is 2.9,For round function also its giving same result for both the cases..

 

CELAMBARASAN
Partner - Champion
Partner - Champion

Try with this

floor(2.9518876433449)+left(Frac(2.9518876433449),3) gives 2.9

floor(2.9518876433449)+left(Frac(2.9518876433449),4) gives 2.95

Hope it helps

jagan
Luminary Alumni
Luminary Alumni

Hi Anil,

You can also try like this

=Num(Floor(2.9518876433449) & '.' & Left(SubField(2.9518876433449, '.', 2), 1)) for 2.9

=Num(Floor(2.9518876433449) & '.' & Left(SubField(2.9518876433449, '.', 2), 2)) for 2.95

Hope this helps you.

Regards,

Jagan.