Hi everyone, I'm stuck on a problem in OBIEE that's (easily) been stumping me for 10 years, and I still don't have a decent solution. High level, I have a fact table that joins with a "date" dimension and a person dimension (along with other dims that don't play a part in this). The person dimension stores the person's birth date.
Assuming a person will turn 18 years old on Jan 15th, I need to produce a report that looks like the following:
Reporting Date Age in Years
1/13/2016 17
1/14/2016 17
1/15/2016 18
1/16/2016 18
...
Here's what I've tried so far:
1. OBIEE function TIMESTAMPDIFF(SQL_TSI_YEAR, birth_date, reporting_date) : this returns inaccurate ages. It shows the person turning 18 way before they hit their birthdate
2. OBIEE function TIMESTAMPDIFF using any of the other SQL_TSI intervals - haven't found satisfactory solution with this that works properly for leap years, etc.
3. EVALUATE function - I tried setting up an AGE column on the employee dimension, and then using an EVALUATE function to calculate the age using database functions I know work ("trunc(months_between(birth_date, reporting_date) / 12)". This might work ok for metrics, but I couldn't get this to work properly on dimensions. OBIEE doesn't set the query to "group by age" so I get invalid SQL if for example I try to show counts of employees by age.
I'm pretty out of ideas...I've been fighting with this issue for a decade at this point but haven't found a good solution. Does anyone have any other ideas?
Thanks,
Scott