OBIEE alternative – the FILTER function. Like CASE statements, you can use the FILTER function to build a logical column expression. In the Expression Builder, this function can be found under Functions > Display Functions > Filter. Here is an example of how to use it:
Suppose you have two Logical Columns derived from the following expressions:
- UAE:
CASE WHEN Paint.Markets.Region = ‘UAE’ THEN Paint. SalesFacts.Dollars ELSE 0 END - INDIA:
CASE WHEN Paint.Markets.Region = ‘INDIA’ THEN Paint. SalesFacts.Dollars ELSE 0 END
- UAE:
FILTER(Paint. SalesFacts.Dollars USING Paint.Markets.Region = ‘UAE’) - INDIA:
FILTER(Paint. SalesFacts.Dollars USING Paint.Markets.Region = ‘INDIA’)
SELECT Physical_yearr,The SQL generated from the CASE statements may look more like this:
SUM(CASE WHEN Region = ‘UAE’ THEN Dollars),
SUM(CASE WHEN product = ‘Samsung’ THEN Dollars)
FROM physical_table
WHERE Region = ‘UAE’ OR Region = ‘INDIA’
GROUP BY Physical_year
SELECT Physical_year,The major difference is that the FILTER SQL includes the criteria in the WHERE clause. In most cases, this means that the WHERE clause would run first, constraining the result set before the CASE statements are run, hence the improvement in performance.
SUM(CASE WHEN Region = ‘UAE’ THEN Dollars ELSE 0),
SUM(CASE WHEN product = ‘Samsung’ THEN Dollars ELSE 0)
FROM physical_table
GROUP BY Physical_year