Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
enriquem
Creator
Creator

Sub function

Hi All!!

I'm trying to do a function like i show, but i can't get the result that i hope.

The function it's transformating the value of the parameter to a format value even Milllion, thousands....

Here I put some examples to do this with a function:

SUB formatNum (Value)

  IF Value<num(100000) THEN

  Value = Num(Value,'#.##0 €;-#.##0 €')

  ELSEIF Value<num(1000000)

  Value = Num(Value/num(1000),'#.##0,0 k€;-#.##0,0 k€')

  ELSE

  Value = Num(Value/num(1000000),'#.##0,00 M€;-#.##0,00 M€')

  ENDIF

ENDSUB

OR with a Calculated Variable:

LET suma= 'IF($1<num(99999), Num($1,"#.##0 €;-#.##0 €"), IF($1<num(1000000), Num($1/num(1000),"#.##0,0 k€;-#.##0,0 k€"), Num($1/num(1000000),"#.##0,00 M€;-#.##0,00 M€")))';

The code its rigth, but i can't call the sub function from an text object, and i can't get the correct result with the calculatedValue because I dont escape the simple comma char.

Note: to call the calculated variable use:

=$(suma(3131231211231223))

Thanks All and Regards.

Kind Regards,
Enrique Mora.
1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Don't know whether this will help or not but you can also use below for formatting your numbers.

Scaling Numbers and DSE Tips | Qlikview Cookbook

View solution in original post

1 Reply
MK_QSL
MVP
MVP

Don't know whether this will help or not but you can also use below for formatting your numbers.

Scaling Numbers and DSE Tips | Qlikview Cookbook