Join us in Las Vegas on June 13-16 for the Snowflake Summit

Learn More
Get Started Transforming Your Data in Snowflake

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()

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


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


What is this expression doing?

IF DATEADD(‘year’, DATEDIFF(‘year’, [Birthday], TODAY()), [Birthday])> TODAY(), – in this part of the expression, we add the years that we calculate from the difference between the date of birth and today


    DATEDIFF(‘year’, [Birthday], TODAY())-1 since we are using the IF function to check the correct age display. since at the time of calculations, the birthday may not yet come. then we subtract one year so that the data is displayed correctly

    DATEDIFF(‘year’, [Birthday], TODAY())

END if the expression is incorrect, then we just display the age

That is how to calculate age in Tableau using the DATEDIFF expression.

From 1 Week to 1 Hour!

Build Data Models Faster in Datameer Than in Tabelau Prep.

Try Free Now


Up Next:

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

More Resources We Think You Might Like

Tableau Questions

How can I increase the size of the pie chart wi...

When you create a Pie Chart, you can resize the circle using the image’s functionality. But...

  • Tableau FAQs
  • December 11, 2018

Power BI and Tableau: A Comparison

Salesforce’s Tableau and a Microsoft Product Power BI have emerged as two leading players in the ...

  • Benoite Yver
  • January 11, 2020
Tableau Questions

How do I write a Case Statement With Multiple C...

I have two conditions using separate fields, but Tableau won’t let me write it as I would l...

  • Tableau FAQs
  • December 13, 2018