Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

b_garside
Valued Contributor

Conditional formatting in Pivot table not working propoerly

I have a Pivot table that displays bandwidth as a percentage 0-1. I have bands of colors 5 of them based on .2 intervals.

For whatever reason my formula is not treating the colors equally. If I use a single column straight table it works fine.

In some cases a value done not get any color.

Unfortunately I can not upload a QVW on this one since its a customer.

Bandwitdht ranges usually in increments of 1.6 but once summed up you get larger values but the max rang is 95 on any given hour.

vDayScale = 30.42

MaxBandWidthRange = 95

eBandWidth = (Sum(BandWidth) / vDayScale) / MaxBandWidthRange

If( $(eBandWidth) >= 1 , RGB(0,110,255) ,
If( $(eBandWidth) >= .8 and $(eBandWidth) <= .99 , RGB(40,140,255) ,
If( $(eBandWidth) >= .60 and $(eBandWidth) <= .79 , RGB(75,155,255) ,
If( $(eBandWidth) >= .40 and $(eBandWidth) <= .59 , RGB(110,175,255) ,
If( $(eBandWidth) >= .20 and $(eBandWidth) <= .39 , RGB(145,195,255) ,
If( $(eBandWidth) >= .01 and $(eBandWidth) <= .19 , RGB(221,240,255)
      )  )  )  )  )  )

2013-12-20_132614.png

1 Solution

Accepted Solutions
MVP
MVP

Re: Conditional formatting in Pivot table not working propoerly

If( $(eBandWidth) >= 1 , RGB(0,110,255) ,
If( $(eBandWidth) >= .8 and $(eBandWidth) < 1 , RGB(40,140,255) ,
If( $(eBandWidth) >= .60 and $(eBandWidth) < .8 , RGB(75,155,255) ,
If( $(eBandWidth) >= .40 and $(eBandWidth) < .6 , RGB(110,175,255) ,
If( $(eBandWidth) >= .20 and $(eBandWidth) < .4 , RGB(145,195,255) ,
If( $(eBandWidth) >= .0 and $(eBandWidth) < .2 , RGB(221,240,255)
      )  )  )  )  )  )

12 Replies
MVP
MVP

Re: Conditional formatting in Pivot table not working propoerly

Could it be a rounding issue?

I mean, if sum(BandWidth) is for example .194 or .196, it may be shown as 0.19 resp. 0.20, but your background color expression seems not to cover these values.

b_garside
Valued Contributor

Re: Conditional formatting in Pivot table not working propoerly

I was starting to think the same and still may be one of the issues.

But when I used the ColorMix wizard It would only evaluate a Single column at a time so you would have dark colors with high value next a low.

2013-12-20_134942.png

b_garside
Valued Contributor

Re: Conditional formatting in Pivot table not working propoerly

How would i round it ? use Round function or Ceil, Floor. 

MVP
MVP

Re: Conditional formatting in Pivot table not working propoerly

No, I was thinking of something like

If( $(eBandWidth) >= 1 , RGB(0,110,255) ,
If( $(eBandWidth) >= .8 and $(eBandWidth) < 1 , RGB(40,140,255) ,
If( $(eBandWidth) >= .60 and $(eBandWidth) < .8 , RGB(75,155,255) ,
If( $(eBandWidth) >= .40 and $(eBandWidth) < .6 , RGB(110,175,255) ,
If( $(eBandWidth) >= .20 and $(eBandWidth) < .4 , RGB(145,195,255) ,
If( $(eBandWidth) >= .01 and $(eBandWidth) < .2 , RGB(221,240,255)
      )  )  )  )  )  )

b_garside
Valued Contributor

Re: Conditional formatting in Pivot table not working propoerly

Still left some uncolored while smaller values disappeared since its rounding up.

Round((Sum(BandWidth / vDayScale)) / MaxBandWidth, 0.01 )

b_garside
Valued Contributor

Re: Conditional formatting in Pivot table not working propoerly

Ok yeah. That really helped. Makes sense. Don't leave any small gaps.

b_garside
Valued Contributor

Re: Conditional formatting in Pivot table not working propoerly

So it seemed too good to be true. See below

2013-12-20_144031.png

Percent values...correlate no colors in some cells.

2013-12-20_144225.png

MVP
MVP

Re: Conditional formatting in Pivot table not working propoerly

Where do the large values suddenly come from? Have you removed the division by your constants?

I thought it is intentional, but your lower limit for a color is still >= 0.01?

b_garside
Valued Contributor

Re: Conditional formatting in Pivot table not working propoerly

It must be since the values are too low? I'll let it be.

Community Browser