Reputation: 71
Trying to convert access iif statement
IIf(FD.[Sales_Value] = 0, 'Component',
(IIf(FD.[Lines] = 0,
IIf(FD.[Sales_Value] = FD.[Gross_Contribution],
'Composite', 'N'),
'N')
)
) AS Composite,
I have this at the moment but it doesn't like it
CASE WHEN FD.[Sales_Value] = 0 THEN 'Component'
ELSE CASE WHEN FD.[Lines] = 0 THEN
CASE WHEN FD.[Sales_Value] = FD.[Gross_Contribution] THEN 'Composite' ELSE 'N' --END
ELSE
'N'
END
END
AS Composite
Upvotes: 0
Views: 205
Reputation: 15150
This should work, much better readable:
CASE
WHEN FD.[Sales_Value] = 0 THEN 'Component'
WHEN FD.[Lines] = 0 AND FD.[Sales_Value] = FD.[Gross_Contribution]
THEN 'Composite'
ELSE 'N'
END
AS Composite
Upvotes: 2