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

How Do I set different background colors based on column label and value within that column?

Ok, so I'm new to Qlikview Sense so bear with me.

Basically, I've got a pivot table that looks like this:

Now, what I need to do is set conditional formatting on the column header.  For example, for "Basic DL" my "Green" condition might be values less than 950, but on "Basic Titles" my "green" condition might be values less than 900.  I've played around with the background color conditions and expressions (ColumnNo, Column, Lookup, etc), but I just cannot get the right combination of functions to get this right.  Any thoughts or help would be greatly appreciated.  Please note this is for Qlikview Sense Desktop.

13 Replies
Not applicable
Author

You can expand my previous post to a nested IF as such:

If([COLUMN NAME A] <=950, LightRed(),

If([COLUMN NAME A] >=950, Yellow())),

If([COLUMN NAME B] <=950, LightRed(),

If([COLUMN NAME B] >=950, Yellow())),

))))


Though, I suspect you have separate measures which simply refer to the same metric with altering calculations. If this is the case, you can refer to my previous post and simply specify the column name as above [Column Name A] rather than the metric.


Regards,


Michael

Not applicable
Author

See the issue is that only evaluates the last result then applies it to the entire pivot table:

Not applicable
Author

Can I see a sample QVF?

TKendrick20
Partner - Specialist
Partner - Specialist

You need to use the formulas rather than the column names in order to get this functionality. I've taken a few screenshots of an application I've built which color codes specific cells in a column. First, I created some variables for my colors so if I want to change the color I only have to do it in one place and all of the colors update automatically.

I have a table like so:

ExImage2.PNG

I want to color code the Average Score and Self Score columns:

ExImage1.PNG

The expression in the Average Score column is:

Avg(IF([Participant Group]<>'Self',[Answer Choice Value]))

The expression in the custom background color option is:

IF(Avg(IF([Participant Group]<>'Self',[Answer Choice Value]))=0,vYellow,

     IF(Avg(IF([Participant Group]<>'Self',[Answer Choice Value]))>0,

          IF(Avg(IF([Participant Group]<>'Self',[Answer Choice Value]))<=2,

               IF(Avg(IF([Participant Group]<>'Self',[Answer Choice Value]))>1,vLightGreen,vGreenYellow),vScoreGreen),

          IF(Avg(IF([Participant Group]<>'Self',[Answer Choice Value]))>=-2,

               IF(Avg(IF([Participant Group]<>'Self',[Answer Choice Value]))<-1,vOrange,vOrangeYellow),vScoreRed)))

Which looks really obnoxious, but notice I'm using the same exact expression nested in some if statements to define the cutoff points for 7 distinct colors. An expression like this will need to be built for each column.