Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I am trying to format a string into percentage, but really struggling with Num and Num# functions. Below is the data which I receive from the data source :
Product Name | Rate |
P1 | 5.766233766233767 |
P2 | 0.0 |
P3 | 4.247104247104247 |
P4 | 0.0 |
P5 | 4.086538461538462 |
P6 | 4.975124378109453 |
P7 | 0.0 |
P8 | 3.3932135728542914 |
P9 | 0.0 |
P10 | 4.10958904109589 |
I would like the field "Rate" (which is a string) to be formatted as percentage with only two places after decimal (so 5.76% for P1 say). I have to keep the number formatting as Auto, so I need to achieve this by Num/Num# functions.
Can anyone please help me ?
Thanks and Regards,
Madhuparna Dhar
Hi,
use this
load
"Product Name",
num(num#(Rate,'#.0############','.',',')/100,'#.## %','.',',') as Rate;
LOAD * INLINE [
Product Name, Rate
P1, 5.766233766233767
P2, 0.0
P3, 4.247104247104247
P4, 0.0
P5, 4.086538461538462
P6, 4.975124378109453
P7, 0.0
P8, 3.3932135728542914
P9, 0.0
P10, 4.10958904109589
];
Regards
Perhaps this?
Floor(Rate, '0.01')
Hi,
use this
load
"Product Name",
num(num#(Rate,'#.0############','.',',')/100,'#.## %','.',',') as Rate;
LOAD * INLINE [
Product Name, Rate
P1, 5.766233766233767
P2, 0.0
P3, 4.247104247104247
P4, 0.0
P5, 4.086538461538462
P6, 4.975124378109453
P7, 0.0
P8, 3.3932135728542914
P9, 0.0
P10, 4.10958904109589
];
Regards