Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
clarachac
Contributor III
Contributor III

Number format in a variable

Hello,

I have created a variable : vSales = sum(Montant_Ventes)
This variable can go from 0 to Billions.
I have to use this variable in the title of a KPI but I want it to be displayed respecting the format below: 
SET NumericalAbbreviation='3:k;6:M;9:Mds;12:T;15:P;18:E;21:Z;24:Y;-3:m;-6:μ;-9:n;-12:p;-15:f;-18:a;-21:z;-24:y';

How can I do that?

Labels (1)
1 Solution

Accepted Solutions
jannis_qlik
Contributor
Contributor

You're correct. Numerical Abbreviations are utilized only when the variable serves as the value for the KPI and the format is set to "Automatic".

If you wish to display the value with the Numerical Abbreviation in the title, you'll need to reconstruct this function within the expression of the variable. It would look something like this:

//...
if([yourValue] >= 1000000, num([yourValue] /1000000, '#,## M'),
if([yourValue] >= 1000, num([yourValue] /1000, '#,## k'),
num([yourValue] , '#,##0')))
//...

You can extend the code to include additional numerical abbreviations.

View solution in original post

4 Replies
MatheusC
Specialist
Specialist

@clarachac 

The kpi formatting will follow the configuration made in main. You can configure the desired formatting in the main application.

MatheusC_0-1704809849409.png

If you need another alternative for formatting, I believe the solution in this topic can help you.
https://community.qlik.com/t5/App-Development/KPI-number-formatting/td-p/1736185

Att, Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
clarachac
Contributor III
Contributor III
Author

Hello @MatheusC ,
if I put sum(Montant_Ventes) in a measure, yes it follows the format configurated in main. 
But my problem is with the variables, they don't follow the same format as configurated in main. 
And I have to put sum(Montant_Ventes) in a variable to be able to use it in the title.

jannis_qlik
Contributor
Contributor

You're correct. Numerical Abbreviations are utilized only when the variable serves as the value for the KPI and the format is set to "Automatic".

If you wish to display the value with the Numerical Abbreviation in the title, you'll need to reconstruct this function within the expression of the variable. It would look something like this:

//...
if([yourValue] >= 1000000, num([yourValue] /1000000, '#,## M'),
if([yourValue] >= 1000, num([yourValue] /1000, '#,## k'),
num([yourValue] , '#,##0')))
//...

You can extend the code to include additional numerical abbreviations.

MatheusC
Specialist
Specialist

@clarachac 
see the link I left above.

Greetings.

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!