5 Replies Latest reply on Mar 31, 2017 5:13 AM by Alex Braun

# How to conditionally format a stacked bar chart based on a threshold value

Hi

Is it possible to conditionally format a stacked bar chart based on two different values. I tried the below calculated field but I am getting only records which are greater than the threshold value.

If SUM([Number of Records]) > [Threshold]) then "RED" ELSEIF SUM([Number of Records]) < [Threshold] then "GREEN" END

I am looking for something like below. Where 1-5 are categories.

What I want is , Say if Category A has 50 and the threshoid is 10 ,  The chart should be like the Thresold limit should be Green and then Red for the exceeding value.

Any help on this would be really helful.

• ###### 1. Re: How to conditionally format a stacked bar chart based on a threshold value

Your calcuation should be correct, but you need to put your number of records in the view and add the color calculation to the colors.  Take a look at the sample workbook attached.

• ###### 2. Re: How to conditionally format a stacked bar chart based on a threshold value

Hi Alex,

Thanks for the reply. But this is not what I am looking for . I want something like below.

Where 1-5 are difference categories.

• ###### 3. Re: How to conditionally format a stacked bar chart based on a threshold value

Hi Raghavendra,

Does this help

Cheers! MD

• ###### 4. Re: How to conditionally format a stacked bar chart based on a threshold value

Thanks for the reply, but this is not what I want. I have attached the workbook in here along with the dataset

I am looking for, say for Category C, the value is 60 and the Threshold limit is 45, I would like to have a bar/ stacked chart where up-to 45 the bar shows green and the difference of 15 as Red.

 C 45 60

and similarly for Category E, where 50 is showing as Green and 15 as red.

is the value is less than threshold then it shows only the value with Green color.

if this is possible it would be really great.

• ###### 5. Re: How to conditionally format a stacked bar chart based on a threshold value

Ok, I think I understand what you are going for now, please take a look at the new workbook on sheet 2.

First I created a difference calculation which takes the threshold - value if it is positive, else 0.

Then I added the Measure Values to the columns and in there I had the diff and value and chose the Bar chart type and it made it into a stacked bar chart.