Qlik Community

Qlik Sense App Development

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

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
madhuparnadhar
New Contributor III

Format string as percentage

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 NameRate
P15.766233766233767
P20.0
P34.247104247104247
P40.0
P54.086538461538462
P64.975124378109453
P70.0
P83.3932135728542914
P90.0
P104.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

 

1 Solution

Accepted Solutions
Partner
Partner

Re: Format string as percentage

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

View solution in original post

3 Replies

Re: Format string as percentage

Perhaps this?

Floor(Rate, '0.01')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Partner
Partner

Re: Format string as percentage

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

View solution in original post

madhuparnadhar
New Contributor III

Re: Format string as percentage

Hi @martinpohl ,

This works perfectly.

Thank you so much for your quick help!

Regards,

Madhuparna