Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

color banding on multiple rows (using rank() ?)

This seems like this should be easy but I cannot get this to work.  I want to alternate colors for rows of a table but the rows will be in groups of variable size.  I thought that I could use the rank function to denote the groups and then flag the rank as even or odd to control the color banding, but this is not working for me for some reason.  Here is some sample data:

Load * Inline [

Pt, Date, Product, Order

123, 1/1/2017, Apples, Order1

123, 1/1/2017, Pears, Order1

123, 1/1/2017, Oranges, Order2

123, 2/1/2017, Apples, Order3

123, 2/1/2017, Oranges, Order4

123, 2/1/2017, Bananas, Order5

123, 3/3/2017, Bananas, Order6

123, 3/3/2017, Pears, Order7

123, 3/3/2017, Apples, Order8

];

Here is what I am getting, The column Pt is first in the sort order...I know the rank function depends on sort order.

2017-11-13_11-42-22.jpg

What I am after is this...

2017-11-13_11-42-22_2.jpg

Thanks in advance for any help.  Feel free to suggest an easier way to do this.

12 Replies
Anonymous
Not applicable
Author

This method works if the data displayed in the chart are the complete contents of the loaded table.  However, the data in the table I want to display is the result of selections in the app and so this solution could also produce consecutive colored bands.

mdmukramali
Specialist III
Specialist III

Hi brianrmacdonald

have you seen my solution?

Anonymous
Not applicable
Author

Yes, I looked at it.  It depends on the assumption that consecutive dates in the chart are even/odd which is not a good assumption.  It is entirely possible that the selections made by the user will include all even days or all odd dates or random occurrences of either.