Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Display decimals without condensing or trailing zeros

Without formatting, numbers are condensing after 5 decimal places.

Decimals Condensed.PNG

Now I can format this to show all the numbers formatted to 10 decimal places, but I don't want the trailing zeros.

Decimals Trailing Zeros.PNG

Is it possible to do this with only formatting functions? I'd rather not use string functions to remove the excess zeros.

=ValueLoop(1,10)Desired Result
10.1
2

0.01

30.001
40.0001
50.00001
60.000001
70.0000001
80.00000001
90.000000001
100.0000000001

Thanks.

14 Replies
prat1507
Valued Contributor

Re: Display decimals without condensing or trailing zeros

=Num(0.00200, '##')

Not applicable

Re: Display decimals without condensing or trailing zeros

Is this not the same as applying no formatting? I'm still getting e notation after 5 decimal places.

Decimals Condensed 2.PNG

prat1507
Valued Contributor

Re: Display decimals without condensing or trailing zeros

Apply Num(X,'##')

where X is expression used by you above as Num(1/pow(10,ValueLoop......,'#.#########')

prat1507
Valued Contributor

Re: Display decimals without condensing or trailing zeros

Use

=Num(0.00200, '(dec)')

Not applicable

Re: Display decimals without condensing or trailing zeros

This seems like it technically should work, but it seems to be manipulating the actual results somehow.

Decimals (dec).PNG

prat1507
Valued Contributor

Re: Display decimals without condensing or trailing zeros

Use this

=Num(1/pow(10,ValueLoop(1,10)),'#.'&Repeat('#',ValueLoop(1,10)))

Not applicable

Re: Display decimals without condensing or trailing zeros

Thanks Pratyush, but I need a way to format the decimals in general, not just for this valueloop example.

Not applicable

Re: Display decimals without condensing or trailing zeros

Unfortunately, I think I'm going to have to use string functions to remove the trailing zeros.

This is the best I could come up with:

Replace(RTrim(Replace(Num(1/pow(10, ValueLoop(1,10)),'#.##########'),'0',' ')),' ','0')

Decimals Trailing Zeros Removed.PNG

MVP
MVP

Re: Display decimals without condensing or trailing zeros

Try this may be

=Num(Num(1/pow(10, ValueLoop(1, 10)), '##.##############'), '##.' & Repeat('#', FindOneOf(Mid(Num(1/pow(10, ValueLoop(1, 10)), '##.##############'), Index(Num(1/pow(10, ValueLoop(1, 10)), '##.##############'), '.')), '123456789', -1)-1))

Capture.PNG