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

Formatting KPIs with units based on value

Hi,

I am trying to change the colour of a KPI based on it's value. This works fine for a number or percentage, e.g. 22 or 55%.

How could I make this work for a number with units, e.g. 22°C?

Many thanks,

Will

19 Replies
Not applicable
Author

Brilliant,

thanks again for the clarification. I'm sorry for being slow but I still don't quite follow.

When I have a normal number in the field e.g. 300, I can edit the expression as you mention:

QLIK Formatting Expression Screenshot 4.png

When my KPI has units as below, the field reads: "unable to change the properties because there is an error in the expression"

QLIK Formatting Expression Screenshot 5.png

Do you know how I might proceed for such a field?

Many thanks,

Will

prat1507
Specialist
Specialist

Hi Will

No issues. Can you please tell me what expression have you used to get 22 deg Celsius.

Regards
Pratyush

Not applicable
Author

QLIK Formatting Expression Screenshot Temperature.png

This is the expression: Temperature reads 22°C from a .csv file

prat1507
Specialist
Specialist

I don't find any problem with this. The expression seems to be correct.

You can use if(keepchar(Temperature,-0123456789)>0,rgb(0,255,0),rgb(255,0,0)) in the Color expression.

Regards

Pratyush

Not applicable
Author

Do you know how I can write a color expression? Unfortunately with the expression I screenshotted I am still seeing the error shown above: "unable to change the properties because there is an error in the expression".

I had assumed this was because there are units on the end of it, since when I type num(left(Temperature,2)) into the expression for the measure I can change the color without issues.

Do you know how I can type the expression for colour when I am receiving the error shown above?

Many thanks,

Will

prat1507
Specialist
Specialist

ok, can you use num(left(Temperature,2)) & right(Temperature,2)


Plz check with the above expression.

Regards

Pratyush

Not applicable
Author

QLIK Formatting Expression Screenshot 7.png

I have tried this as shown above, but I am still receiving the same error as when I used the expression Temperature

prat1507
Specialist
Specialist

Use this to show degree celsius icon.

desk.png

Click on number formatting,choose custom.

and add °C in format pattern.


Regards
Pratyush

prat1507
Specialist
Specialist

After you're done with this.

Go to Appearance tab-> Go to Color

Enable Conditional Colors

Click on Add Limit (remember only once)

Below that there will be fx text box

Type this exp =if(Temperature>0,0.25,0.75)

You can select colors by clicking on the sections you want

desk.png

prat1507
Specialist
Specialist

Sorry, but change the expression to =if(Temperature>0,0.75,0.25).


Sorry, it was a trouble from my part, I haven't used a KPI either in qliksense, but finally it worked out for me, I hope it works out for you too.


Regards
Pratyush