# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
New Contributor II

## Problem to color by dimension

Hello everybody,

I have a question about color by dimension. I have a combo chart with x axis: minutes to complete a job, and y-axis: count(jobs). I want to color one bar which has the minute = avg of delivery time.  I typed the formula in color by dimension (minute). The problem is that if I assign a fixed number, I got the right color code as the photo.

=if(Minutes= 14,'red','rgb(70,124,175)')

But if I change the fixed number to avg(deliverd_date-started_date) => Qlik doesn't understand and turn color in grey.

Could anybody help me?

Thank you so much,

2 Solutions

Accepted Solutions
Highlighted
Valued Contributor II

## Re: Problem to color by dimension

can you share the dashboard?

Highlighted
Valued Contributor II

## Re: Problem to color by dimension

try this:

=if(Minutes =
floor(avg(total if( (CanceledDate-RequestDate)*24*60>0 and match(ErrorCode,'NULL') and isnull(PickedDate-RequestDate),(CanceledDate-RequestDate)*24*60,(DeliveredDate-RequestDate)*24*60)))
,'red','rgb(70,124,175)')

4 Replies
Highlighted
Valued Contributor II

## Re: Problem to color by dimension

can you share the dashboard?

Highlighted
New Contributor II

## Re: Problem to color by dimension

Hello,

Thank you for your help. I need help to color the minute = avg delivery time.

The calculation that I used:

=if(Minutes =
floor(avg(if( (CanceledDate-RequestDate)*24*60>0 and match(ErrorCode,'NULL') and isnull(PickedDate-RequestDate),(CanceledDate-RequestDate)*24*60,(DeliveredDate-RequestDate)*24*60)))
,'red','rgb(70,124,175)')

Highlighted
Valued Contributor II

## Re: Problem to color by dimension

try this:

=if(Minutes =
floor(avg(total if( (CanceledDate-RequestDate)*24*60>0 and match(ErrorCode,'NULL') and isnull(PickedDate-RequestDate),(CanceledDate-RequestDate)*24*60,(DeliveredDate-RequestDate)*24*60)))
,'red','rgb(70,124,175)')

Highlighted
New Contributor II

## Re: Problem to color by dimension

Perfect, it works. Thank you so much.