Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Qlik Connect 2025! Where innovative solutions turn your data visions into reality: REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to set a color for par or impar values?

Hi,

I have a pivot table, and set the months as columns, I need to make that the background of the impar months are grey, for month 1 the background should be grey, the month 2 should be blank, the month 3 should be grey and so.

What would be an expression to make this possible?

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

use expression:

if(mod(Month,2)<>0,lightgray())

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

10 Replies
vinieme12
Champion III
Champion III

use expression:

if(mod(Month,2)<>0,lightgray())

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

That worked, but not completely.

I have the following table:

What I need is that each column for the YRMON field (displayed as 2015-01 and so)will be filled with the grey color and not only the header of the month.

How can I do that?

surendraj
Specialist
Specialist

Hi,

r u looking for this...!!!

Capture.PNG

--Surendra

Anonymous
Not applicable
Author

Exactly!!!

vinieme12
Champion III
Champion III

You need to add it to the expression background not the dimension background

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

OK, the problem is that my field is represented as '2016-01', so the way that we calculate it is not making any difference and all the columns are set with the same color.

How can I use if(mod(Month,2)<>0,lightgray()) but where Month is expressed like '2016-01'

vinieme12
Champion III
Champion III

Then use below

if(mod(Num (right (Month,2)),2)<>0,lightgray())

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
surendraj
Specialist
Specialist

Hi Roberto,

   you can do it by writing expression in background color option. or else

   you just right click on  pivot table---->custom format cell...

   by this you can customize particular required columns as per your required colors.

note: right click on headers or cells.

it will works.try it.

--surendra

surendraj
Specialist
Specialist

Hi,


did u got the solution?


--Surendra