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: 
Anonymous
Not applicable

Color the total row

Hi

I have a chart where the background colors are changed for each of the expression , I have an expression something like if col1>col2 then yellow kind of , my problem is even total row is getting colored when the above condition is satisfied which I don't want.

I tried changing the background color by right click custom format cell , dimenstionality() , rowno () = 0 in the if statements .. nothing worked , how do I specify not to color total rows ...

Thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Script:

ExampleData:

Load

    *

Inline

[

Country, IsActive,Qty

A,Y,5 

A,Y,5

A,Y,5

B,N,3

C,N,1

];

Straight table chart with Country and IsActive as dimensions.

20151109_1.GIF

First expression is sum(qty).

Expression 2 - Dimensionality()

Expression 3 - Dimensionality(), but with Total Mode set to No Total.

Expression 4 - Dimensionality(). Totals turned back on, Background Color set to

=if(sum(Qty)>10,LightBlue(),LightGray())

Expression 5 - Dimensionality(). Totals turned back on, Background Color set to

=if(Dimensionality()=0,red(),if(sum(Qty)>10,LightBlue(),LightGray()))

If you want to show as grey instead, try:

=if(Dimensionality()=0,RGB(240,240,240),if(sum(Qty)>10,LightBlue(),LightGray()))

The Background Color is available by clicking the plus symbol next to the expression.

20151109_2.GIF

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You should be able to detect the Total row in an if() with dimensionality(). Try adding a dimensionality() column to your chart to make sure you are testing the right value. Can you upload a sample?

-Rob

Anonymous
Not applicable
Author

Script:

ExampleData:

Load

    *

Inline

[

Country, IsActive,Qty

A,Y,5 

A,Y,5

A,Y,5

B,N,3

C,N,1

];

Straight table chart with Country and IsActive as dimensions.

20151109_1.GIF

First expression is sum(qty).

Expression 2 - Dimensionality()

Expression 3 - Dimensionality(), but with Total Mode set to No Total.

Expression 4 - Dimensionality(). Totals turned back on, Background Color set to

=if(sum(Qty)>10,LightBlue(),LightGray())

Expression 5 - Dimensionality(). Totals turned back on, Background Color set to

=if(Dimensionality()=0,red(),if(sum(Qty)>10,LightBlue(),LightGray()))

If you want to show as grey instead, try:

=if(Dimensionality()=0,RGB(240,240,240),if(sum(Qty)>10,LightBlue(),LightGray()))

The Background Color is available by clicking the plus symbol next to the expression.

20151109_2.GIF