6 Replies Latest reply on Jul 1, 2018 10:51 AM by Ken Flerlage

Calculating Age based off Date for Bin use

Hello tableau community,

I am having some difficulty with a file I'm working with. I would like to create a histogram for NTF By Age that is a little easier to digest. My current histogram shows the date of our clients birth based on year compared to the total account net worth's (about one account per year in the style I have it).  from that year. Currently I have a separate bar for each year that someone was born but ultimately I would like to create bins of ages (say 20-40, 40-60...) in order to show total new to firm net worth by age My DOB is formatted as Month/Date/Year and month is not numerical.

Is there an easier way to create bins with a dimension that can't be converted to a measure? I want bins calculated by age not net worth (which is my measure). The way I have it formatted currently is a bit of a mess.

• 1. Re: Calculating Age based off Date for Bin use

How exactly does your date format look? Can you give some examples? Any chance of getting some sample data or a packaged workbook? If confidential, can you just make up a bit of data?

• 2. Re: Calculating Age based off Date for Bin use

Ken,

When I apply a MDY filter to the rows my date is filtered as something like August 11th, 1990 however on my data sheet is imported from excel and the data is formatted as 8/11/1990. If you would like me to make up some data please let me know! I really appreciate the help.

• 3. Re: Calculating Age based off Date for Bin use

I created a sample data set in Excel (attached). In Tableau, I then created an Age calculated field with the following formula:

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

ELSE

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

END

Then, using this, you can create a histogram and set the bin size to whatever you like. In the attached workbook, I've set the bin size to 10.

If this helps to address your question, please be sure to mark this answer as helpful or as the "correct answer". This will help others who may have similar questions in the future. Thanks!!

1 of 1 people found this helpful
• 4. Re: Calculating Age based off Date for Bin use

Ken,

I am still having trouble with Age and getting it to create bins. For some reason after I have added age as a measure with the formula you have used when I left click to create, bins, bins doesn't show up. Do you know if I'm missing a step?

I really appreciate you setting up and example!

• 5. Re: Calculating Age based off Date for Bin use

Never mind Ken I have resolved it! thank you for all of your assistance, I really appreciate it!

Best

Michaela

• 6. Re: Calculating Age based off Date for Bin use

Michaela, would you mind sharing the resolution to your problem, then marking your answer as the "correct answer"? This will help others who may have similar problems in the future. Thanks!