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

Dynamic number scaling/formatting for charts and tables

Hello All

 

I would like scale my KPIs and calculations (e.g. 1,564,657.45 to 1.6 M€ and so on) in charts and tables. I have a few very complex calculations within my QlikView application which I cannot calculate with the loading script but all my calculations are in variables defined. I have a variable “vScaleNumber” in my loading script for the dynamic scaling but it doesn’t work as designated:

 

SET vScaleNumber = if($1>1000000, num($1/1000000,'#,##0.000M'),if($1>1000, num($1/1000,'#,##0.000K'),num($1,'#,##0')));

 

And I use this variable for my expressions

 

ExampleExpression = $(vScaleNumber($(=$(vAVGSellingPrice))))

 

// My Variable AVGSellingPrice = [Sales revenue]/[Sales quantity]

 

The formatting works but I get the same value (total sum) for all dimension values (e.g. Productline 1 = xxx, Productline 2 = xxx, (…)). Once I use only my variable vAVGSelling Price I get Productline 1 = aaa, ProductLine 2 = bbb and so on. How can I get the correct and formatted values? Thanks in advance

 

2 Replies
sunny_talwar

Do you have a sample you can share to show your issue?

swuehl
MVP
MVP

It's probably just a matter of how you define your variables, with or without equal sign and how you call the variables:

The Magic of Variables