Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
1. In my table, I have only year of Birth. I need to calculate the age. Can some one help me.
2. Also, I need to group the age like 0>35, 35-45, 50-60 in a bar chart.
Help me out.
Clever Anjos suggested a LOAD script solution, which is recommended.
If you want to use the expressions in a chart, remove the 'as Age'
=Age(Today(), MakeDate(BirthYear))
(and use this as calculated dimension?)
What is the measure of your chart?
Create these fields into your script
1 - Age(Today(), MakeDate(youryearbirth)) as Age
2 - Using this field
If( Age < =35, '0>35',
If(Age <= 45,'35-45', '50-60')) as AgeBin
Try use Interval()
1 - Interval( Today()-BirthAge, 'D' ) /365 AS Age
2-
If( Age < =35, '0>35',
If(Age <= 45,'35-45', '50-60')) as Range
Its not working. My field name is BirthYear. So I tried it. It says error in expression.
Age(Today(), MakeDate(BirthYear)) as Age
Even I tried,
Age(Today(), MakeDate[BirthYear]) as Age
Hi,
Sry its not working. This is the script I tried out
Interval( Today()-BirthYear, 'D' ) /365 AS Age
This expression is certainly correct and must work
Age(Today(), MakeDate(BirthYear)) as Age
Something you're are not telling... What are the values of the BirthYear field?
Clever Anjos suggested a LOAD script solution, which is recommended.
If you want to use the expressions in a chart, remove the 'as Age'
=Age(Today(), MakeDate(BirthYear))
(and use this as calculated dimension?)
What is the measure of your chart?
Thanks Stefan, its working. Am using Emp ID as measure, so that I can find the age of a particular employee in my table. Is it fine.
I need help in grouping the ages. Help me out.
Are you really using Emp ID as measure? That's kind of unusual, I would have used Emp ID as dimension and the age as measure, if you want to show the age per emp.
If you want to group by the age and show for example how many emps are in this age range, use something like
= If( Age < =35, '0>35',
If(Age <= 45,'35-45', '50-60'))
as calculated dimension and
=Count(DISTINCT [Emp ID])
as measure.