Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Shading every other row in Pivot table

Hi all,

I'm trying to shade every other row in a pivot table simply based on being the odd or even row number. In other words rows 1,3,5,6,9,etc. would be a color and 2,4,6,8,10,etc. would be another color.

I've tried to write code on the background color of the field using rowno() and count() but no success.

Any suggestions would be extremely helpful.

12 Replies
Not applicable
Author

In a straight table it is a setting, but that doesn't work for a pivot table. However, you can set the background color on dimensions and expressions.

Dimension: click on the plus-sign in front of the dimension and double-click on the Background Color option.

Expression: click on the plus-sign in front of the dimension and click on the Background Color option. There is a Definition window on the right now.

Add the following expression to all the Background Color fields (dimensions and expressions):


=if(even(RowNo()),lightgray(),white())


If you don't like the color, you can use a lot of other standard colors (search 'color' in the help) or use RGB(230,230,230) for lighter grey for instance.

Not applicable
Author

Gud example is given by Mark. There is also a feature called 'ColorMix', see help. It is used to set colors for text, or background. More detail is available in manual on ColorMix.

Not applicable
Author

Cool ... thanks for the tip sunil18vns Smile

Not applicable
Author

Thanks for your help.

Where can find the manual on ColorMix?

Not applicable
Author

It can be found in the Help. Just search for 'colormix'. I can post the text if you like Smile

Not applicable
Author

Oops, double post ...

Not applicable
Author

In my case, it works when I have one dimension. But when I put multiple dimensions, the same formula does not work. Can anyone please check and let me know the reason.

Not applicable
Author

To be able to do that, you need an identifier for field product.

That way you can replace the 'even(RowNo())' part with something that identifies each product.

Have you tried the Color Mix Wizard?

Not applicable
Author

Hi Mark,

I searched for colormix in Help. I'm still not sure how to start/access the colormix wizard from the instructions below:

With the Colormix Wizard, opened from the File menu in the Edit Expression dialog, it is possible to create a colormix expression, i.e. an expression that calculates a dynamic color from a given measure.

Can you give me more specific instructions to access the colormix wizard?

Thanks

Ward