Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
matrix123
Contributor III
Contributor III

How to change the background color of a toggling dimension value in straight table

Hello,

I have a straight table in Qlikview with the below values:

Col1                  Col2                        Col3

Value1             ABC                         Datetimestamp

Value1             XYZ                          Datetimestamp

Value1             ABC                        Datetimestamp

Value 1             XYZ                        Datetimestamp

The thing is Col2 dimension is having toggling values like ABC,XYZ and varies as per the timestamp in col3 which can also be millisecond difference and datetimestamp is not constant and keeps changing in time/second/millisecond.

I want to change the background color of Col2 cell only and i used the backgroud color expression in the Col2 dimension

if(above(col2,0)<>above(col2,1),RED(),GREEN())

and even tried the below:

if(mod(Row(),2)=0,red(),green())

both the times it ended changing the entire column color to one color.

But I just want to change the cell background color of Col2 alternatively based on current , previous values.

Could you pls help.

 

 

1 Solution

Accepted Solutions
matrix123
Contributor III
Contributor III
Author

Hi,

I used below in the straight table Col2 dimension background expression:

if(mid(rowno(total),2)=0,yellow(),red())

it works now..

Thanks

View solution in original post

7 Replies
Kushal_Chawda

Your expression Just need Aggr function

Assuming  Col2,Col1,Col3 are your dimensions . Note that you need to include all the dimension in aggr to work.

=aggr(if(Above(Col2)<>Col2,Red(),Green()),Col2,Col1,Col3)

matrix123
Contributor III
Contributor III
Author

Hi Kush,

Thanks for your reply. I tried with adding aggr outside and mentioned all my diemsion columns i used in the straight table but again it changed the color of the entire column Col2. 

I was looking to change only the col2 cell background alternatively based on toggle values. Say if I have 4 values in the column Col2, then i want to change the background color of those 4 values alternatively from RED , GREEN .

I am still not sure how to achieve it.

Thanks,

 

 

Kushal_Chawda

Would you be able to share sample?

johnca
Specialist
Specialist

You will need to have data with the same value in column 2 for it to work. Your example does not.

data:
load * inline [id, col1, col2, col3
1,value1,ABC,value2
2,value1,XYZ,value2
3,value1,ABC,value3
4,value1,ABC,value3
5,value1,XYZ,value3
];

(note lines id3 and id4 are the same)

Create the straight table using all dimensions and the expression for background color will be just as you tried;

if(above(col2,0)<>above(col2,1),RED(),GREEN())

This had all rows red except for id4 because ABC = ABC. it was green.

 

HTH,

John

matrix123
Contributor III
Contributor III
Author

Hi John,

Thanks for coming back to me.  I have attached a sample file here and it is exactly the data I get from the system which I am showing in straight table, since the Col2 flip flops for the same col1 value over different times, the requirement is to show the col2 background color to highlight in alternate colors. Attached is just a sample data and I have thousands of lines coming from the source which can be like the sample data.

the requirement is to show the all the values in C2 with background color switching alternatively as the value flip flops.

I tried with background color formula for C2 Dimension as 

=if(mid(rowno(),2)=0,yellow(),red())

--it changes again whole column color for 4 row cells to single color instead of changing alternatively

Col2 values always filp flop and that is the requirement to show for such values only.

Thanks,

Matrix

 

matrix123
Contributor III
Contributor III
Author

Hi Kush,

Attached is my sample excel. 

Thanks,

Matrix

matrix123
Contributor III
Contributor III
Author

Hi,

I used below in the straight table Col2 dimension background expression:

if(mid(rowno(total),2)=0,yellow(),red())

it works now..

Thanks