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: 
dvarner22
Partner - Contributor
Partner - Contributor

Formatting Numbers in a KPI - Qliksense

Hi There

I am using the same structured calculation as below and it works 100% in a flat table, as soon as you use it in a bar chart or KPI etc the numbers show but the symbol gets dropped for some reason.

if(Sum(Sales) > 1000000,  num(Sum(Sales)/1000000, '#.##0,##M', ',', '.'),

    if(Sum(Sales) > 1000, num(Sum(Sales)/1000,  '#.##0,##K', ',', '.'), num(Sum(Sales), '#.##0,##', ',', '.')))

Using Auto or custom Formatting is not an option as I need to dictate to the calculation at what points I want what symbols.

Any ideas how to do this?

7 Replies
shraddha_g
Partner - Master III
Partner - Master III

Try

if(Sum(Sales) > 1000000,  num(Sum(Sales)/1000000, '#.##0M'),

    if(Sum(Sales) > 1000, num(Sum(Sales)/1000,  '#.##0K'), num(Sum(Sales), '#.##0')))

dvarner22
Partner - Contributor
Partner - Contributor
Author

The expression still gives me the same result but there is still no symbol in my KPI.

The issue is not the result its that the chart just decides on its own to exclude the symbols

MK9885
Master II
Master II

=num(if(Sum(Sales) > 1000000,   Sum(Sales)/1000000 , '$#,##0.00 M'),

    num(if(Sum(Sales) > 1000,  Sum(Sales)/1000,   '$#,##0.00 K'), num(Sum(Sales), '$#,##0.00')))

dvarner22
Partner - Contributor
Partner - Contributor
Author

Hi Aehman,

The calculation is perfect and works great for the Value but not for the custom symbol in a simple KPI chart or Bar chart.

I get the correct value eg if the answer is 535 000 000, with the calculation I get 535Mn in the flat table otherwise in the KPI chart I get 535 (Without the symbol).

The loss of the symbol in the chart is my issue.

Does that make sense?

Darryn

MK9885
Master II
Master II

Maybe cus the expression was wrong?

I used

=if(Sum(Sales) > 1000000,  num(Sum(Sales)/1000000 , '$#,##0.00 M'),

    if(Sum(Sales) > 1000,  num(Sum(Sales)/1000,  '$#,##0.00 K'), num(Sum(Sales), '$#,##0.00')))

and it gives me K or M.

However you need to adjust number of 0 when you dividing the sum(Sale) to make sense of those symbols.

Untitled.png

nam
Former Employee
Former Employee

https://community.qlik.com/blog/create-post.jspa?sr=cmenu&containerType=14&containerID=1&draftID=143...

here is a simpler solution, just modify the symbol in the app set statement to anything you want

metric.PNG

Ezir
Creator II
Creator II

Hi @dvarner22 ,

Choice Measure expression :

measure_expression.png

And insert the expression:

 

Dual(Num(Sum(Sales)/Pow(10,3*(Div(Log10(Sum(Sales)),3))),'#.##0,0')&pick(div(Log10(Sum(Sales)),3),'k','M','B','T'),Sum(Sales))

 

I hope helps.