Friday, August 29, 2014

Issue with FLOOR option in OBIEE

Friends, be careful with the floor option in OBIEE. Demonstrating a simple example which can make your calculation wrong.



Data type of Customer_Key is double.
 


After using CUSTOMER_KEY in a calculation 1 and 2 in logical layer, the data type of calculated field changed to INT.
Calculation 1: 
 

Calculation 2:
 
When Calculation 1 and 2 are used in a % calculation, OBIEE is using FLOOR option and making the result “0”
Calculation 3 [% calculation]:
 
 
OBIEE will apply FLOOR option by default on to the query and make it zero. This can be resolved using 2 simple workaround:
a) Type caste 'Calculation 1 or 2' into a DOUBLE [Remember, type casting % calculation into DOUBLE will not resolve your issue]
b)  Multiply Calculation 1 with a "1.0" making it a numeric data type.

Not sure if this is an expected behavior from OBIEE but in case you have not noticed it, please be careful especially when you are using COUNT aggregation [because the DOUBLE got converted to INT when COUNT was used in aggregation].