Announcements
cancel
Showing results for
Did you mean:
Contributor

## Color expession on a large formula

Hi guys.

Little bit of help need as I`m a complete Qlik novice.

I`ve had to construct a column which shows an average sale % movement, I`ve created added the formula below, but was hoping i could color code the results such as: if its a loss show in red, if it`s a gain show in green or if it breaks even, show in grey.

But if i try and add in the formula to the color expression, it breaks?

((
Sum(if([Sales Invoice Date]>=[Date change in front of customer] and [Is Sales Account]='Yes',[Sales Qty]))
/
Floor(((Today()-[Date change in front of customer]))/7)
)
-
(
Sum(if([Sales Invoice Date]>Date(AddMonths([Date change in front of customer],-12)) and [Sales Invoice Date]<[Date change in front of customer] and [Is Sales Account]='Yes',[Sales Qty]))
/
52
))
/
(
Sum(if([Sales Invoice Date]>Date(AddMonths([Date change in front of customer],-12)) and [Sales Invoice Date]<[Date change in front of customer] and [Is Sales Account]='Yes',[Sales Qty]))
/
52
)

2 Replies
Specialist

In what way does it break? Does it give an error, does it do nothing,... Tell us a bit more on what exactly happens.

Partner - Contributor III

Hi

Break down your expression, put individuals part into variables.

then check variable values.

After that you can make your expressions in terms of variables.

Using this approach, It will be easy to find the place where it is failing.

Hope this will solve your problem.