How to calculate age in Tableau workbook?

  • Tableau FAQs
  • December 13, 2018

To calculate age in Tableau, you need to use the date functions. So, for example, to solve this problem, we can use the DATEADD and DATEDIFF functions. The first function is used to add a certain number of days, months, etc., to the current date. The second function calculates the interval between two dates. This is a powerful combination of functions, and it will help calculate not only age but also any interval between two dates.

IF DATEADD('year', DATEDIFF('year', [Birthday], TODAY()), [Birthday])> TODAY()
        THEN

    DATEDIFF('year', [Birthday], TODAY())-1

ELSE

    DATEDIFF('year', [Birthday], TODAY())

END

 


Up Next:

Read How do I make a funnel-like graph in Tableau with multiple measures?