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

Color coding

Hi, 

I am trying to color code values based on age. Using in Text Color within Pivot Table.

=if(max(Age) < 30, RGB(100,200,100),
if((max(Age) > 30 and max(Age) <= 60), RGB(51,51,255),
if(max(Age)> 60 AND ALT(Age,1), RGB(255,0,0)
)))

The above code only color codes few values and not all.

For instance, it color codes some values which are <30 and does not for few others. Please let me know if there is any other solution. Thanks!

 

Labels (3)
5 Replies
Kushal_Chawda

@varunamin  try to replace max(Age)  with max(total Age) 

varunamin
Contributor III
Contributor III
Author

@Kushal_Chawda Tried but still not working.

Vegar
MVP
MVP

Have you tried adding the expressions max(Age)  and ALT(Age,1) as measures into your pivot table in order to examine the output? Does these expressions provide the expected output?

Why are you using the ALT(Age,1) criteria? I would guess that all rows will return a numeric and therefore always be true in your if statement. 

avinashelite

What's the dimension you using ? and will you able to share the sample file , so that we could check the issue 

varunamin
Contributor III
Contributor III
Author

@Vegar 

Can remove the ALT() function as it won't make any difference . Was using it to exclude the null values in calculation.

Tried max(Age) in Expression and got the values as 0 for those where the color coding does not work. Those rows have valid data in them but still shows 0.

varunamin_0-1603923137422.png

@avinashelite  Using 3 dimensions and using the above code in one of the Text Color fields.

There is 1 Expression which counts the values. Sorry won't be able to share the data.

Thanks!