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: 
Anonymous
Not applicable

Color Coding KPI using Set Analysis and simple comparison functions

Hello everyone,

New Qlik Sense/ Qlik View user here.

I want to create a KPI, where the conditional coloring will filter based on two fields:

- EstArrivalTimeHrMinSec      [Estimated time taken for an Ambulance to arrive at Incident scene (Predicted time)]

- TimeTakenforAmbulancetoArrive     [Actual time taken for an Ambulance to arrive at Incident scene (Actual time)]

These two fields (fieldnames are in italics) are both formatted in Time('mm:ss') format for comparison, and I basically want to calculate:

- If Actual time taken < Estimated time taken

then I want the KPI to be displayed in GREEN (actual time for the ambulance to arrive is earlier than predicted, which is GOOD).

-If Actual time taken > Estimated time taken

then I want the KPI to be displayed in RED(actual time taken is later than predicted, which is BAD).

I have already tried creating a conditional coloring in a KPI object on my own, and here is my expression:

=If(Time(avg({$}TimeTakenforAmbulancetoArrive), 'mm:ss') < Time(avg({$}EstArrivalTimeHrMinSec), 'mm:ss'), Time(avg({$}TimeTakenforAmbulancetoArrive), 'mm:ss'), Time(avg({$}EstArrivalTimeHrMinSec), 'mm:ss'))

Sometimes the conditional coloring will work, sometimes it wouldn't, and I don't know what exactly I'm doing incorrectly with my expression. I have attached a snapshot below regarding the issue.

When the expression sometimes works (time displayed correctly as GREEN)

works1.PNG

When the expression doesn't work (time should display as GREEN instead of RED)

qlik1.PNG

Please help! Thanks in advance.

2 Replies
Anil_Babu_Samineni

Equation seems worked. Can you share QVF file to test rather discuss on fly

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Anonymous
Not applicable
Author

I can share the .qvf file with you, but it draws data from a local data connection, and I don't think the sheet will run properly without the data. I am not able to give you the data though, unfortunately as it is confidential.

Is there another way I could pass you the file? Perhaps making a sample subset of my data?