Qlik Community

Ask a Question

App Development

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

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hjm35055
Partner
Partner

Qlik Sense color expression issue

Hi Everyone,

I have the following graph that is using set analysis to limit what it displays. This works great and do not have any issues.

Screen Shot 2017-01-20 at 11.25.03 AM.png

measure for chart above = avg({<StrategicAim={"Organizational Vitality"}>}ObservedNumerator)

However, when I try to add an expression to change the bars to red or green based on the target, the bar colors change, but I lose my set analysis and it pulls everything back in.  Below is the color expression I am using.  I am hoping I am doing something wrong here. I think I am missing something with "IF (DesiredDirectionUp=-1" but not sure.

IF (DesiredDirectionUp=-1,

  IF (AVG({<StrategicAim={"Organizational Vitality"}>}ObservedNumerator)

   >=

  avg({<StrategicAim={"Organizational Vitality"}>}[Target (OHTargets)]),red(),green()),

  IF (AVG({<StrategicAim={"Organizational Vitality"}>}ObservedNumerator)

   <=

  avg({<StrategicAim={"Organizational Vitality"}>}[Target (OHTargets)]),Green(),Red()))

Thank you!

3 Replies
rittermd
Master
Master

Where are you putting this expression?

If you replaced your measure with the new version for the colors then it will no longer do what it was doing before. 

If want to control colors you should put this expression in the Appearance/Colors and Legends and do a color by expression.

hjm35055
Partner
Partner
Author

This expression is in the measure for the graph:

     avg({<StrategicAim={"Organizational Vitality"}>}ObservedNumerator)

This expression is in the color by expression field:

IF (DesiredDirectionUp=-1,

  IF (AVG({<StrategicAim={"Organizational Vitality"}>}ObservedNumerator)

   >=

  avg({<StrategicAim={"Organizational Vitality"}>}[Target (OHTargets)]),red(),green()),

  IF (AVG({<StrategicAim={"Organizational Vitality"}>}ObservedNumerator)

   <=

  avg({<StrategicAim={"Organizational Vitality"}>}[Target (OHTargets)]),Green(),Red()))

   

Not applicable

I am having the same issue with a set of charts I am making. I have trend charts by FY. I only want to show the trend for 2 years and I want to specify what color each year is.

Making the chart is easy, but when I use the color by expression I get data for the other FY equal to all zeros which makes my trend line look flat.

When I changed my equation from set notation to if statements I was able to specify the colors of the lines without any problems.