Does anybody fancy themselves a SQL guru that would like to give me some pointers on cleaning up this mess of a CASE WHEN statement? We have a list of product lines (item classes) that either roll up as Product or Services that our company offers. My management wants to see Gross Profit and Revenue numbers broken out as well as overall and the SQL statement I've come up with below is the best way I have figured out to make that happen. Below is an example of how I calculate the Services Gross Profit numbers from a search with Main Line set to False in the criteria, so it is an item level search.
Field: Formula (Currency)
Summary Type: Sum
Formula: CASE WHEN {item.class} LIKE 'Implementation Services' THEN {altsalesamount} WHEN {item.class} LIKE 'Consulting Services' THEN {altsalesamount} WHEN {item.class} LIKE 'Managed Services' THEN {altsalesamount} WHEN {item.class} LIKE 'Third Party Implementation' THEN {altsalesamount} WHEN {item.class} LIKE 'Third Party Consulting' THEN {altsalesamount} WHEN {item.class} LIKE 'Third Party Managed Services' THEN {altsalesamount} WHEN {item.class} LIKE 'Third Party Services' THEN {altsalesamount} WHEN {item.class} LIKE 'Training' THEN {altsalesamount} WHEN {item.class} LIKE 'Professional Services' THEN {altsalesamount} WHEN {item.class} LIKE 'Residency' THEN {altsalesamount} WHEN {item.class} LIKE 'Service Desk' THEN {altsalesamount} END