2 Replies Latest reply on Aug 22, 2018 11:03 AM by Jonathan Hodge

# KPI LoD Calculation Issues

Howdy All!

In the picture below the bar graphs are for FEDEX Deliveries and Regular Deliveries.

If even ONE bar is red a legend should be below saying that an action is needed. If everything is good then simply be green and say good.

The workbook is attached and below are my calculations. My issue is that on the legend KPI it keeps separating between my Fedex and Regular. Is there a way of writing in Tableau to ignore the categories separately, if even one line is bad, then it's all bad. Sounds like a LoD calculation is needed but I'm not the best at those, especially with implementing it with the calc's below

[Target Colors] Calc to color the red greens for the bars. 0 = green, 1 = red.

IF ATTR([Sales Category]) = 'FEDEX DELIVERIES' AND [Percentage Regular Deliveries] > .98

THEN 0

ELSEIF ATTR([Sales Category]) = 'REGULAR DELIVERIES' AND [Percentage Regular Deliveries] > .92

THEN 0

ELSEIF ATTR([Sales Category]) = 'FEDEX DELIVERIES' AND [Percentage Regular Deliveries] < .98

THEN 1

ELSEIF ATTR([Sales Category]) = 'REGULAR DELIVERIES' AND [Percentage Regular Deliveries] < .92

THEN 1

ELSE 0

END

[Targets Colors Good Bad] Tries to say if even 1 bar is red then record as bad, otherwise good.

IF WINDOW_SUM([Targets Colors]) >= 1

ELSE 'Good'

END

Thanks so much for any help!

• ###### 1. Re: KPI LoD Calculation Issues

Could you please check if the following satisfies the requirement

Thanks,

• ###### 2. Re: KPI LoD Calculation Issues

That was perfect!

I was able to replicate on my side with the real dataset but I just like to understand everything that occurs.

Could you elaborate on what you did, or if this is the explanation below:

1.) For the colors when calculating across the table it was separating my categories. When I choose to calculate on category does it lump the categories into 1 big pile? In that circumstance it found something           >= 1 returning and colors each category the same accordingly.

2.) Now that every box is the same color, to limit the boxes that appear you place an index filter that only returns 1 of them. I guess the part that confuses me is that if the index calculates off category, and category is           now lumped into 1. How is index ever finding a 1-2? Should it just be a 1 to begin with?

Thanks again!