January 18, 2017 at 2:25 pm
Hello,
Is there a way to avoid repeating a case statement. If the first is true, there is an amount subtracted from the result of the Case Statement. If if it is false, just the case statement result is printed. See below for an example. I hope this makes sense.
CASE WHEN TestField >0 THEN
( CASE WHEN SalesField = 'B' THEN SalesAmount
WHEN Sales2Field = 'C' THEN Sales2Amount
WHEN Sales3Field = 'D' THEN Sales3Amount
ELSE 0 END) - TestField
ELSE
( CASE WHEN SalesField = 'B' THEN SalesAmount
WHEN Sales2Field = 'C' THEN Sales2Amount
WHEN Sales3Field = 'D' THEN Sales3Amount
ELSE 0 END)
January 18, 2017 at 3:04 pm
Disregard - I found a solution by adding the Testfield after the minus sign as it's own case statement.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply