6 Replies Latest reply: Aug 10, 2017 9:15 AM by Alison Cooke

Colour Expression for Budget Variance

Hello,

I would like some help in formulating a text colour expression.

I want the text to be green when the variance ([Project Year Budget]) - sum([Project Expenditure Amount]) is less than the budget. But I also want the text to be red when the variance falls below zero. And, yellow when the variance is equal to the budget.

I have tried to do so using this expression:

if((sum([Project Year Budget]) - sum([Project Expenditure Amount])) < sum([Project Year Budget]), green (255)

,if((sum([Project Year Budget]) - sum([Project Expenditure Amount])) <'-1', red ()

,if((sum([Project Year Budget]) - sum([Project Expenditure Amount])) = sum([Project Year Budget]), RGB(255,128,0)

)))

The yellow and green text is working correctly. But I cannot work out how to get variance below zero to turn red. I imagine it is because a value below zero is also less than the project year budget and thus it turns green as it is commanded to do in the first line of the expression.

How would I get it to work?

Thank you in advance

• Re: Colour Expression for Budget Variance

It will evaluate in order of the IF statement.  So make the first check be the condition for RED, if that is met then all other conditions will not be checked.  The move on from there with the second check.

• Re: Colour Expression for Budget Variance

Hi Dan,

Thanks for your response.

Do you mean like this?

if((sum([Project Year Budget]) - sum([Project Expenditure Amount])) <0, red (255)

,if((sum([Project Year Budget]) - sum([Project Expenditure Amount])) < sum([Project Year Budget]), green (255)

,if((sum([Project Year Budget]) - sum([Project Expenditure Amount])) = sum([Project Year Budget]), RGB(255,128,0)

)))

If so, unfortunately that doesn't work.

• Re: Colour Expression for Budget Variance

IF( Sum([Project Expenditure Amount]) > Sum([Project Year Budget]) , RED(),

IF( Sum([Project Expenditure Amount]) < Sum([Project Year Budget]) , GREEN(),YELLOW()

))

the way you wrote the green condition won't this always be true assuming there is any spend?

sum([Project Year Budget]) - sum([Project Expenditure Amount]) < sum([Project Year Budget])

Can you elaborate on which results are not working?

• Re: Colour Expression for Budget Variance

Hi,

I have tried that but unfortunately it isn't working.

Using the expression in my initial post, it is only making the negative values red that is not working.

• Re: Colour Expression for Budget Variance

not sure why it isn't working.  can you post some data or a sample qvf to work from?

• Re: Colour Expression for Budget Variance

Hi Dan,

As I cannot share the data with you, I was just making a test app to send to you but your expression worked for it. Strange! I am unsure what is causing the issue on my end in that case. But, thank you, your expression works.