KNOWLEDGE BASE

How to calculate age from the date of birth


Published: 15 Jun 2022
Last Modified Date: 16 Jun 2022

Question

How to calculate age from the date of birth.
(Example)
 Today : 2022/06/15
 Date of birth : 1996/04/21
 Age : 26

Environment

  • Tableau Desktop

Answer

1. Connect to Sample(Birthday).xlsx from Tableau Desktop
2. Create a new calculated field as following.
       Name : Age
       Calculation : IF DATEADD('year', DATEDIFF('year', [Birthday], TODAY()), [Birthday])> TODAY() THEN
                            DATEDIFF('year', [Birthday], TODAY())-1
                            ELSE
                            DATEDIFF('year', [Birthday], TODAY())
                            END
Did this article resolve the issue?