Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

yufaichristophe
New Contributor

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
Highlighted

Re: Color Coding KPI using Set Analysis and simple comparison functions

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

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)
yufaichristophe
New Contributor

Re: Color Coding KPI using Set Analysis and simple comparison functions

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?