11 Replies Latest reply: Aug 30, 2016 11:38 AM by Praveena Velagapudi

# Qlik Sense KPI Number Format Auto

I am using KPI number format displaying with 1.22M which is correct with Auto Format, But I want display with one decimal format like 1.2M. if I change the format either Number or Custom ,  my KPI displaying complete KPI Values such as 1,222,200.97. How can is change format to display my KPI values as 1.2M without 2nd decimal and complete values.

I tried with Simply KPI extension and default Qliksense KPI object, but unable to display KPI values what I wanted.

Thanks

Raj

• ###### Re: Qlik Sense KPI Number Format Auto

Divide the value by 1000000 and then format that with 1 decimal and a M for millions:

• ###### Re: Qlik Sense KPI Number Format Auto

Hello Gysbert Wassenaar,

Thank you so much for your help.  Thanks Raj

• ###### Re: Qlik Sense KPI Number Format Auto

Hello Gysbert Wassenaar,

How about if the values random numbers like, Thousands, Mill, etc, can we make dynamic based on values?

Thanks

Raj

• ###### Re: Qlik Sense KPI Number Format Auto

I also have this problem.  Hardcoding an "M" is too limiting.  Is there a way to make it dynamic?

• ###### Re: Qlik Sense KPI Number Format Auto

Try an expression like this one:

=pick(ceil(log10(sum(Sales))/3),

num(sum(Sales),'#,##0.0'),

num(sum(Sales)/1000,'#,##0.0 K'),

num(sum(Sales)/1000000,'#,##0.0 M')

) & ''

• ###### Re: Qlik Sense KPI Number Format Auto

Gysbert,

This is great, thank you.  I wrote something very similar but my expression did not work.

What purpose does the ampersand and quotes serve after the pick function?

Thank you,

Mike

• ###### Re: Qlik Sense KPI Number Format Auto

It makes the result of the entire expression a string value so that Qlik Sense doesn't try to apply a numeric format to it.

• ###### Re: Qlik Sense KPI Number Format Auto

Thank you for explaining.

• ###### Re: Qlik Sense KPI Number Format Auto

How can I get G to B format in Charts like Bar? 'if' with 'Num' is not working

• ###### Re: Qlik Sense KPI Number Format Auto

Hello All and Gysbert, I try to with you your expression with KPI object, but it is not displaying what I wanted, such as 34.2M or 23.3K etc, depending on values.

the following code Answered by Rob.

I am able apply below code for showing dynamic values with correct format, but I just need to add one decimal to values,  can you please check below code, and help me how to add decimal point from below code.

Thanks

Ram

I create a variable in the script like this:

SET vScaleNumber=if(\$1>1000000, num(\$1/1000000,'#,##0.000M')

,if(\$1>1000, num(\$1/1000,'#,##0.000K')

,num(\$1,'#,##0')

));

And then use it in expressions like this:

\$(vScaleNumber(sum(InvoiceValue)))

• ###### Re: Qlik Sense KPI Number Format Auto

Raju,

Gysbert's expression works for me but only with the ampersand and quotes (& '').  Did you try with these characters added to your expression?

I asked Gysbert why these characters are required.

Mike