You can use aggr() and variable.
Somthing like that:
if(sum(Planned)-sum([actual value])>10, 1,
if(sum(Planned)-sum([actual value])>5, 2, 3
Where Dim1, Dim2 are your dimensions in your straight table.
So you will have 1 for red, 2 for yellow, 3 for green.
And you will be able this value to get colour.