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: 
souadouert
Specialist
Specialist

Num format

HELLO


I need to use the num function to format a number, but the number of digits



after the comma is dynamic according to a column

10 Replies
sunny_talwar

What do you mean? Would you be able to show an example?

prma7799
Master III
Master III

Please share some sample

souadouert
Specialist
Specialist
Author

Capture.PNG

YoussefBelloum
Champion
Champion

Hi,


try this:


if(NB=3, num(...,'FORMAT1'), if(NB=2, num(...,'FORMAT2'), num(...,'FORMAT3')

souadouert
Specialist
Specialist
Author

Hello youssef , i need to test this format in load script

YoussefBelloum
Champion
Champion

yes you can do it like this on the script.

try it

YoussefBelloum
Champion
Champion

Sorry this method didn't works for me on the script, as soon as I found a solution I'll let you know

YoussefBelloum
Champion
Champion

Maybe this:

num(YOUR_COLUMN,if(match(NB,'3'),'FORMAT1',if(match(NB,'2'),'FORMAT2','FORMAT3'))) as ...

niccolo_chiodar
Contributor II
Contributor II

What about something like this?

The results might depend on what type of chart you're plannig to use the expression, works for me in a pivot table.

Num([CH] ,'#.##0,' & Repeat('0', [NB]))