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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ez
Contributor
Contributor

Num function digits after the comma

Hello,

I have to format an expression into an expression with 2,3 or 4 digits after the comma:

1335,1 - 1.335,10

1335,14  - 1.335,14

1335,145 - 1.335,145

1335,1456 - 1.335,1456

1335,14567- 1.335,1457

 

I tried

Num( 1335,1456, '#.##0,00##', ',' , '.' ),

but there is no difference to

Num( 1335,1456, '#.##0,0000', ',' , '.' ) .

Any suggestions?

Thank You

ez

1 Solution

Accepted Solutions
marcus_sommer

You could set the formatting explicitely depending on the number of digits. The following looked a bit ugly but it worked:

num(1335.1, '#.##0,' & repeat('#', rangemax(2, rangemin(len(subfield(1335.1, '.', 2)), 4))))

- Marcus

 

View solution in original post

2 Replies
marcus_sommer

You could set the formatting explicitely depending on the number of digits. The following looked a bit ugly but it worked:

num(1335.1, '#.##0,' & repeat('#', rangemax(2, rangemin(len(subfield(1335.1, '.', 2)), 4))))

- Marcus

 

ez
Contributor
Contributor
Author

Thank you Marcus,

 

it works.