Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
fzalexanderjohn
Creator
Creator

Always color bottom 50% of table in red according to current sort measure

Office                         Sales 2018 Sales 2019

München400500
Frankfurt30010
Dresden20050
Berlin100200

Say I have the table above and I always want the bottom 50% of the table colored in orange. So when I sort by Sales 2019, the table should then look like this:

Office                          Sales 2018 Sales 2019

München400500
Berlin100200
Dresden20050
Frankfurt30010

 

I tried using RowNo() but then sorting is turned off automatically.

Labels (1)
9 Replies
timpoismans
Specialist
Specialist

You should be able to use the following:

If(RowNo(total)>NoOfRows(total)/2,Red())

You can change the Red() to the colour you want.

This will colour the bottom half of the table in your desired colour. In case of an uneven amount of rows, it'll colour the largest part, e.g.: 5 rows, row 3 till 5 will get a colour.

fzalexanderjohn
Creator
Creator
Author

Thanks, the coloring does work but as soon as I use it, the straight table is no longer sortable, which is the key part here.

pradosh_thakur
Master II
Master II

try this
if (rowno()>=rowno(total)/2,red(),black())
Learning never stops.
fzalexanderjohn
Creator
Creator
Author

Thank you, I still have the problem that sorting is disabled when I use the formula on a straight table.
timpoismans
Specialist
Specialist

I tested it in a straight table and could still sort it. Strange.
fzalexanderjohn
Creator
Creator
Author

Strange indeed. I'm talking about the interactive sorting when you click on the row headers...
timpoismans
Specialist
Specialist

Using the code from my first post, I can do the following:

Sorted by Project_ID:
Sorted_Project_ID.jpg

Sorted by Project_final_status:
Sorted_Project_final_status.jpg

Sorted by Project_start (high to low):
Sorted_Project_start_hightolow.jpg

 

No idea how it works for me, but won't for you.

fzalexanderjohn
Creator
Creator
Author

Is any of that a measure? I used pretty much sum(sales) (and 3 others like it). So I have one dimension and 3 measures.
timpoismans
Specialist
Specialist

Yea, there's 3 measures in the table.