Calculate age with date of birth only? OBIEE

I would like to calculate age based on DOB.  I get a syntax error.  Not familiar with the proper syntax of PL/SQL for nesting of IF/THEN statements.  Any help would be fantastic:

@{Current_Date} = current Date

"Employee personal attributes. "" Date of birth of the employee ' = DOB

WHEN IFNULL("Employee Personal Attributes"."Employee Birth Date", 0)<> 0 THEN
    
    WHEN MONTH("Employee Personal Attributes"."Employee Birth Date") <  (Month(@{CURRENT_DATE})) Or (Month("Employee Personal Attributes"."Employee Birth Date") = Month(@{CURRENT_DATE}) And Day("Employee Personal Attributes"."Employee Birth Date") <= Day(@{CURRENT_DATE})) Then
    
    TIMESTAMPDIFF(SQL_TSI_YEAR,"Employee Personal Attributes"."Employee Birth Date", @{CURRENT_DATE})

    Else

    TIMESTAMPDIFF(SQL_TSI_YEAR,"Employee Personal Attributes"."Employee Birth Date", @{CURRENT_DATE})-1
    
    End
    
ELSE

0

End

Any help would be much appreciated!

Hello

I managed to find a date column with some null on my test platform (SA406).

The formula I posted without the NULL case already return 0 when date is NULL (was not really planned).

If you want to use a CASE IFNULL WHEN ("personal attributes used". "" Employee Date of birth»(, 0) <> 0 THEN you'll get an error: "

[nQSError: 59021] CASE conditional expressions have correspond to data types.

So 2 options:

CASE WHEN IFNULL ("personal attributes used". "" Date of birth of the employee»(, CURRENT_DATE) <> CURRENT_DATE THEN "

TIMESTAMPDIFF (SQL_TSI_YEAR, "personal attributes used" "." ") Date of birth of the employee", CURRENT_DATE) + BOX WHEN DAYOFYEAR ("personal attributes used". "Date of birth of the employee") > DAYOFYEAR (CURRENT_DATE) - THEN 1 ELSE 0 END "

ELSE 0 END

or

TIMESTAMPDIFF (SQL_TSI_YEAR, IFNULL ("personal attributes used". "" Date of birth of the employee "(, CURRENT_DATE)(, CURRENT_DATE) + BOX WHEN DAYOFYEAR (IFNULL ("personal attributes used"." Date of birth of the employee", CURRENT_DATE)) > DAYOFYEAR (CURRENT_DATE) - THEN 1 ELSE 0 END

Both did the same thing.

Tags: Business Intelligence

Similar Questions

  • How to calculate age based on user registration date of birth?

    Hi there-

    I am working on a form where the user will enter both their date of birth and date of beginning of employment. I need to create two fields that will calculate their age based on their date of birth and their total number of years of service, based on their start date.

    Someone at - it a good script that make these calculations? I normally use FormCalc, but am open to Java, if there is a simpler solution.

    Thank you

    Erin

    If you use fields to date, tap the calculate text fields, you can put something like

    if ( not DateTimeField1.isNull ) then
        var dateofBirth = Date2Num( DateTimeField1, "YYYY-MM-DD" )
        var currentDate = Date()
    
        var years = ( currentDate - dateofBirth ) / 365
        $ = Floor( years )
    else
        $ = ""
    endif
    

    will be calc, the age, while something similar for startdate

    if ( not DateTimeField2.isNull ) then
        var startDate = Date2Num( DateTimeField2, "YYYY-MM-DD" )
        var currentDate = Date()
    
        var years = ( currentDate - startDate ) / 365
        $ = Floor( years )
    else
        $ = ""
    endif
    
  • Age, based on the Date of birth field

    The problem that I am running is that I have a field "date of birth" which a user fills. There are only 8 spaces allowed feel MMDDYYYY with no separating "/" them.

    Here is the code that I have worked with:

    Event.Value = "";

    var dobValue = getField("date_of_birth").value;

    If ("dobValue! =" ") {}

    var date of birth = util.scand ("mm/dd/yyyy", dobValue);

    var today = new Date();

    calculate age in milliseconds

    var age = today.getTime () - dob.getTime ();

    convert age in years (millsec to sec * min * min in hours s * h in day * days in the year)

    truncated to whole years and adjust for binary floating point error

    Event.Value = Math.floor (age / (1000 * 60 * 60 * 24 * 365.2425)-0.005);

    }

    I tried to remove the "/" to "dd/mm/yyyy', I've also tried of to display MMDDYYYY but still no luck. If I enter 01/01/1990 it will return the exact age of "23".

    All ideas, while running the javascript debugger, it is stated: dob is null

    As always, thank you

    Nathan

    You get errors in the JavaScript console. ?

    As you create a possible number of the value of date of birth, you should use the valueAsString property to keep the value as a string and not let JavaScript convert it to a floating point number.

    Why do you use a different format for the date of birth of string as the format of the field conversion?

    Event.Value = "";
    var cDobField = 'date of birth '; field name date of birth;
    var cDobFormat = 'DDMMYYYY '; format of date of birth;
    oField var = this.getField (cDobField, 0, 0);
    if(oField == null) app.alert ("field of error for access to the"+ cDobField ");
    var dobValue = getField("date_of_Birth").valueAsString;
    If ("dobValue! =" ") {}
    var date of birth = util.scand (cDobFormat, dobValue);
    if(DOB == null) app.alert (' date string conversion Error "+ dobValue +"with the format"+ cDobFormat, 0, 0" ');
    var today = new Date();
    calculate age in milliseconds
    var age = today.getTime () - dob.getTime ();
    convert age in years (millsec to sec * min * min in hours s * h in day * days in the year)
    truncated to whole years and adjust for binary floating point error
    Event.Value = Math.floor (age / (1000 * 60 * 60 * 24 * 365.2425)-0.005);
    }

  • Age of auto-fill Date of birth?

    Hello, I'm looking for a way to have an AGE automatic fill when I get birthday. Fill in the form to work several times a day and I still have to go online and calculate it.

    That's what the box looks like:

    Capture.JPG

    The DOB format is mm/dd/yy but you can enter yyyy and it will automatically change to AA. I want to include the date of birth and age automatic fill relative to the current date. Y at - it script javascript or something that I can insert into the form field? Thank you!

    It worked perfectly.

    var date of birth = util.scand ("mm/dd/yyyy", this.getField("DEFENDANT_DOB").valueAsString);

    If (dob! = null) {}

    var today = new Date();

    var age = today.getFullYear () - dob.getFullYear ();

    var m = today.getMonth () - dob.getMonth ();

    If (m< 0="" ||="" (m="==" 0="" &&="" today.getdate()="">< dob.getdate()))="">

    -years;

    }

    Event.Value = age;

    }

    else {}

    Event.Value = "";

    }

  • calculate with dates

    Hello

    I want to calculate with dates.

    The first date is the current date. The second is a date in the future. In a third field, it should be calculated the amount of the days during these two dates. (taking into account leap years = Schaltjahr...)

    For example:

    First of all the field/date: today is the 23.06.2010

    Second zone/date: the date in the future is the 25.06.2010

    Third field: (2 /) 3 (days)

    Code? : event.value = ((AFMakeNumber (this.getField("dateInTheFuture").value)-(this.getField("curren_tDate").value)))

    Can someone help me?

    Thank you in advance!

    Date2Num and rawValue are LiveCycle objects only. You use LC or

    Acrobat forms?

  • I keep getting emails telling me that if I do not answer with my name, password, Date of birth and the country or territory my Windows Live will be Shut Down

    I keep getting emails telling me that if I do not answer with my name, password, Date of birth and the country or territory my Windows Live will be Shut Down.  The person who sends me emails is also with MSN.  Everyone knows this?  Thanks for your help.

    Thank you for visiting the Microsoft answers community.

    The question you have posted is bound using Windows Live (Messenger) and would be better suited in the Center to help Windows Live Messenger. Please visit this link to find a community that will provide the support you want.

  • How to create user defined groups and users with custom permissions as only open and export in obiee 11 g?

    Hello

    I want to give as open & export to the level of permissions.

    How to create user defined groups and users with custom permissions as only open and export in obiee 11 g?

    For example, if the group permissions, inturn should reflect on the users.

    Please help me.

    Thanks in advance,

    A.Kavya.

    Your question is quite broad and fuzzy then I suggest the security catalog presentation to read documentation: http://docs.oracle.com/middleware/1221/biee/BIESC/mgrgrpsusers.htm#CIHIBJGD

    And I think that you mix you two things which are managed in different places:

    ) an object as read access permissions, write, delete... which control you through the object "Permissions" dialog box

    (b) functional privileges controlled through "Manage privileges" under "Administration".

  • How to use the TRUNC function with dates in the expression builder in OBIEE.

    Hello
    How to use the TRUNC function with dates in the expression builder in OBIEE.
    TRUNC (SYSDATE, 'MM') returns 1 July 2010"where sysdate is July 15, 2010 ' in SQL. I need to use the same in the expression builder in the logical layer mdb column.


    Thanks in advance

    Use it instead:
    TIMESTAMPADD (SQL_TSI_DAY, (DAYOFMONTH (CURRENT_DATE) *-1) + 1, CURRENT_DATE)

  • account is not found, name, first name and date of birth, but it is not!

    try to allow my sons xbox account after the recent upgrade.  After I have connect and click Yes to give him access he says I need acount.live.com to visit t enter my name, date of birth, but when I visit it and login, my name, first name and date of birth are there.

    I'm lost for what to do.
    Any ideas?

    Hi all

    This could be caused if there is no synchronization between the Xbox LIVE account information which are obtained on the LIVE and the information stored locally on your console. Try to remove the profile (delete profile only) and download the album LIVE profile. Here's how:

    How to remove Xbox Live profile safely
    Before to delete your profile, that you know the user name and password for your Microsoft account that is associated with your profile.

    1. Go to settings, then System.
    2. Select storage.
    3. Select all the devices.
    4. Select Gamer profiles.
    5. Select the gamer tag you want to delete.
    6. Select Remove.
    7. Select delete profile only. This deletes the profile but leaves saved games and achievements.

    Clear cache Xbox system
     
    1. Press the Guide button on your controller, go to settingsand select system settings.
    2. Select storage or memory.
    3. Storage device highlight and press is on your controller.
    4. Select clear system Cache.
    5. Clear your cache of Xbox 3 times online system.

    Restart your console

    Download Xbox Live profile.

    1. Press theGuide Xboxbutton on your controller (large button in the center of your controller X).
    2. Select the option download profile.
    3. Enter the Microsoft account associated with your Xbox LIVE player number.
    4. Enter the password for your Microsoft account.

    Let us know in case you need more help.
  • Fastest way to SELECT different people, same date of birth, same ZIP (postal code)

    I have a pretty large table of people over 25 M records. There NAME, ADDRESS, DOB, ZIP, OTHER, etc.

    Ago total of about 9 M people separate for one person it might be more then a recording (that is, change of address, name, etc.)

    I want to choose the DISTINCT people born on the same date and in the same ZIP (postal) code. You are looking for the most effective way to do it.

    Any idea is welcome

    Hello

    Here's one way:

    WITH got_cnt AS

    (

    SELECT person_id, person_name, address, date of birth, zip - or other columns of your choice

    , COUNT (DISTINCT person_id) over (PARTITION BY dob, zip) AS cnt

    FROM table_x

    )

    SELECT *.

    OF got_cnt

    WHERE cnt > 1

    ORDER BY dob, zip

    ;

    It will be faster than other methods because it requires only 1 pass through the table.

  • Correction of my date of birth - tried several times and he keeps asking rest me my security questions (no ANSWER them but reset them). Shut up always back on reboot issues. There is no 'save' button once you make the correction.

    In the account settings my date of birth is incorrect (year) - I tried several times to fix it, but it keeps forcing me to reset my security instead of just answering q. No 'Save' button then tried just 'enter' or 'done'... once more, I get looped back to reset my Q & a I'll be ten years younger, if that's what Apple wants, but it should be fixable.

    Contact Apple:

    Contact Apple for assistance with the security of the Apple ID - Apple Support accounts

  • AutoComplete suggests my user ID and date of birth on the log in page of my savings account - how can I stop this?

    Most of the time the AutoComplete is really useful. However, when I connect my savings account, my user ID and date of birth are available, allowing anyone on my PC to check my account (a security code is required for all transactions which does not seem to be autocomplété!) - how can I turn off this please? This started because I reset Firefox (because of the slow, such as recommended by Firefox). Thank you.

    I know how you can do this:

    1. Delete an AutoComplete suggestion menu entry drop-down
    2. Disable completely auto form fill
    3. Clear all saved form autocomplete entries
    4. Entered AutoComplete clear form selected (using an add-on)

    but I don't think that Firefox has a built-in feature to be selective in what he recorded in the first place.

    For items numbered above:

    (1) when the suggestion appears, use the arrow keys on the keyboard to select the suggestion unwanted in the list and press the delete key.

    See: control if Firefox automatically fills in forms.

    But I don't think that this blocks Firefox to save again in the future.

    (2) change your privacy settings in the Options dialog box

    "3-bar" menu button (or tools) > Options > privacy

    If set ' Firefox will be: remember history ' to take ' conservation rules: use the custom settings for history. " Then you can uncheck the box ' Remember search and form history.

    (3) clear all AutoComplete form data saved

    To clear everything, you can use:

    button '3-bar' menu > history > clear recent history

    If you do not see a list of check boxes, click the Details button. Deselect all categories other than "Form & Search History" for those who are kept. At the top, set the time interval, and then click clean now.

    (4) clear SOME saved form autocomplete entries (when you are not currently using the form)

    You need an add-on for that. In the past, I've only tried this one, but there might be other good: https://addons.mozilla.org/firefox/addon/form-history-control/

  • Error message when you try to update the date of birth for child

    My kids already have Apple Id.

    I'll put up the family sharing and added them to the family using their Apple ID.

    The year of birth is not associated with their profile (guess it was not necessary at the time to create the profiles).

    So I try to update the year of birth, following the instructions provided on several Apple Support pages, for example Apple for your child - Apple Support and sharing of the family IDthat says: "If your child already has an Apple ID, you can update their email address, date of birth, Securityand more."  (date of birth = > link: date of birth associated with update to your Apple - Apple Support ID)

    BUT regardless of where and how I'm trying to update the birth year, I get the error message, it can not be updated at the moment...

    (screenshot Danish text)

    How to upgrade to the year of birth? Or when it will be possible to do the update?

    Kind regards

    Michael

    I understand that your child has had to date and that you will allow once you have received approval

  • Just got an email from "Windows Live Hotmail", _ @_. _ asking me to answer in my name, password, date of birth and country.

    Received suspicious email

    Just got an email from "Windows Live Hotmail", * address email is removed from the privacy * asking me to answer in my name, password, date of birth and country.  ????  "permanent suspension" if I can't do this... links to all the pages from Microsoft including the privacy statement... I will not answer but worry that if it is a scam people.  Any thoughts?

    Hello

    Its a SCAM!

    In the United States, you can contact the FBI, Attorney general, the police authorities and consumer
    Watch groups. Arm yourself with knowledge.

    The Internet Crime Complaint Center (IC3) is a partnership between the Federal Bureau of Investigation
    (FBI) and the National White Collar Crime Center (NW3C), funded in part by the Bureau of Justice Assistance
    (BJA).
    http://www.ic3.gov/complaint/default.aspx

    No, Microsoft would not email or call you unsolicited. Or they would know if there were any errors
    on your computer. So those are the frauds or scams to get your money or worse to steal your
    identity.

    Avoid scams that use the Microsoft name fraudulently - Microsoft is not unsolicited
    phone calls to help you fix your computer
    http://www.Microsoft.com/protect/fraud/phishing/msName.aspx

    Scams and hoaxes
    http://support.Microsoft.com/contactus/cu_sc_virsec_master?ws=support#tab3

    Microsoft Support Center consumer
    https://consumersecuritysupport.Microsoft.com/default.aspx?altbrand=true&SD=GN&ln=en-us&St=1&wfxredirect=1&gssnb=1

    Microsoft technical support
    http://support.Microsoft.com/contactus/?ws=support#TAB0

    Microsoft - contact technical support
    http://Windows.Microsoft.com/en-us/Windows/help/contact-support

    ==============================================================

    Windows Live Solution Center - HotMail - HotMail Forums Solutions
    http://answers.Microsoft.com/en-us/windowslive

    Windows Help and how
    http://Windows.Microsoft.com/en-us/Windows/help

    Hotmail - Forums
    http://answers.Microsoft.com/en-us/windowslive/Forum/Hotmail

    Hotmail - Solutions and how additional resources
    http://Windows.Microsoft.com/en-us/Hotmail/help-center

    Hotmail - how to - FAQ
    http://Windows.Microsoft.com/en-us/Hotmail/Hotmail-how-do-i-FAQ

    Why my account is temporarily blocked?
    http://Windows.Microsoft.com/en-us/Hotmail/account-temporarily-blocked-FAQ

    What should I do if my account has been hacked?
    http://windowslivehelp.com/solution.aspx?SolutionID=6ea0c7b3-1473-4176-b03f-145b951dcb41

    Hotmail hacked? Take these steps
    http://blogs.msdn.com/b/securitytipstalk/archive/2010/07/07/Hotmail-hacked-take-these-steps.aspx

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • How can I get the Date of birth, I used on my Email

    I need to know how to find the Date of birth, which I used on my WLID

    Hello

    Go here and scroll down to and click on connect to Account Services - then connect and you will see the
    setting including your Date of birth.

    Windows Live ID
    https://accountservices.passport.NET/ppnetworkhome.SRF?VV=1200&mkt=en-us&LC=1033

    For more help with Windows Live please use their support and the forums.

    Windows Live Solution Center - accounts and passwords - Windows Live ID
    http://www.windowslivehelp.com/

    I hope this helps and happy holidays!

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

Maybe you are looking for

  • Problem installing nVidia - display - update of NVIDIA GeForce 8200 M G

    I got this daily demand of upgrade for the first time since at least two weeks. my computer will try and install, but it still fails. I know how to disable install it but next time my computer to search for new updates, it is added again. How can I f

  • 5 d mark iii points AF (concentrate) is displayed on the LCD

    On my 5 d mark iii, I can only see where are the autofocus points, but not those that focus.  Is it possible to see which points are under discussion?

  • want to buy the new Tablet

    Hello I own an Acer I own the acer iconia A1 Tablet - 810 - L888 16 GB Wi - Fi and I love this tablet. I am very interested to buy another Tablet and not spend a lot of money... I was watching two first is tablets Iconia B1-710-L401 8 GB one is Iconi

  • Guard KB3122656 & KB3127229 install s self on my windows Vista PC.

    Whenever I turn on my computer updates following day came and have already updated on the computer! A security update for MS .NET Framework 4.5.2 on Windows Vista, Windows 7, Windows Server 2008 (KB3122656) & (KB3127229).  So far I've had them moved

  • Error PowerConnect 3448.

    Hello, I'm having problems with a Dell PowerConnect 3448.The switch was restarting, logging in I saw several posts that appeared as the type: ADDMCPORTSFATAL: SW2G_mcmac_add_port: TAPI error in mc add egress port, port e9 vidx 4098 status Operation f