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

Coloring Rows


Hello Everybody,

I have a table box as below

CompanydivisionEmpNameSalary
Comp1div1X15000
Comp2div2Y16000
Comp3div3Z17000
Comp4div4P18000

Now I want the rows should be colored alternatively.

For Ex    Row1 = Blue, Row 2 = Green

              Row 3 = Blue, Row 4 = Green

Please advise.

Thanks in Advance

Sonali Singh

6 Replies
JonnyPoole
Employee
Employee

Try this as the cell background color.

if (  mod( RowNo( total ) , 2 ) = 1, lightblue(), lightgreen())

Use other color functions like rgb() to get better colors

Capture.PNG.png

Not applicable
Author

Alternatively, you can go into User Settings >> Design Tab  >> select Advanced under the default styling mode >> close out of that and right click on one of the cells >> select Custom Format Cell >> Play around there -- not sure if there is an 'every other row' function, but you can set background color.

It is generally held as best practice for colors to only be used to call attention to certain important data.  The layout tab on chart properties should be sufficient to differentiate between adjacent rows in a table.  Save color definitions to represent important data and positive/negative KPIs.

Not applicable
Author

Hi Jonathan,

Thanks for reply. It is working but my requirement is something different.

Submission IDTrans IDAmount
2E300
3A500
3B1050
5C39
7C400
7D350

Now what I want is

 

If Submission ID "2" is given blue then 3 should "yellow" then again 5 should be blue and 7 should be yellow.

But my ouput is coming something like this. Please find the attached file.

I am using a Pivot table for this.

Thanks In Advanse

Sonali

Not applicable
Author

Sonali, I would use the Format Cell option described in my post with advanced default layout.

krishna20
Specialist II
Specialist II

Hi,

Use Text Format in expanding your Expression .You can change the font color whatever you want to display for the particular row, by using like RGB(250,125,132).

Hope this helps

Regards

Krishna

JonnyPoole
Employee
Employee

In a pivot table the rowno() won't work. Instead you can use rank() to figure out the rows of the higher buckets

For the screenshot below the first expression has this background color

=if( mod(aggr( rank( total Division), Division), 2)=1,yellow(),lightred())

The 2nd (company) goes back to using the rowno()

=if( mod(RowNo(Total),2)=1,yellow(),lightred())

Capture.PNG.png