Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
mtabernad
Partner
Partner

Problem with a color expression

Hi everyone,

I am using this expression as KPI, which is the std deviation of number of connections over the daily average:

(count({$<date_id={"$(=max(date_id))"}>}connect_time) - (count({$<date_id=>}connect_time)/count(distinct {$<date_id=>}date_id)))

/

(count({$<date_id=>}connect_time)/count(distinct {$<date_id=>}date_id))

 

also I built a bar chart to see this deviation by user with the following color expression:

 

if(((count({$<date_id={"$(=max(date_id))"}>}connect_time) (count({$<date_id=>}connect_time)/count(distinct date_id)))
/
(count({$<date_id=>}connect_time)/count(distinct date_id)))<=0.50,Green(),rgb(255,31,31))

 

 

KPI expression and color expression work for maximum date (in my case 31/10/2019)

Capture1.png

 

But if I pick the previous day on the date filter panel (30/10/2019) or other days, KPI expression still works but color expression doesn't:

Capture2.png

 

Could anyone help me?

 

Thank you very much.

Labels (4)
1 Solution

Accepted Solutions
hallquist_nate
Partner
Partner

Your expression for the KPI is not matching your expression for the color definition.  You are missing sthe set expresions is formula segments as show below in the pic.

Expression Diff.PNG

 

This is always a tricky excercise for me.  I reduce risk by copying and pasting my KPI formula into my If() statement.

Hope this helps,

Nate

View solution in original post

2 Replies
hallquist_nate
Partner
Partner

Your expression for the KPI is not matching your expression for the color definition.  You are missing sthe set expresions is formula segments as show below in the pic.

Expression Diff.PNG

 

This is always a tricky excercise for me.  I reduce risk by copying and pasting my KPI formula into my If() statement.

Hope this helps,

Nate

View solution in original post

mtabernad
Partner
Partner
Author

Ohhh! You were sooo right! I don't know why I didn't realize about it. Thank you very much!