Forum Discussion
Relative age?
Hey everyone.
So, I've calculated the age of my "customers" by a simple dax:
Age =
DATEDIFF(
MAX(Dim_Customer[Birthday]);
TODAY();
YEAR
)
and it, of course, works perfectly. I've also created a column that puts everyone in an age "group" via a simple switch.
BUT - I now need to create a diagram, where I list the number of customers per year, split into age groups - it would work best in an area chart, with the year as axis, age group as legend, and the number of customers as a value.
People age... meaning my age column is a bit useless. Unless I can figure out how to make that age (and the age group) relative?
I have a relative year column in my date (RelativeYear = Date[Year] - Year(Today())), but that's not really helpful in the chart...
Any ideas how I can tackle this?
12 Replies
- vanessafvgCommunity Champion
grggmrtn what is the structure of your data and how would you be calling this, if you can give me a sample of your data that would be useful, or dummy data
- grggmrtnPost Patron
Hi vanessafvg
The structure is just about as complicated as they come, but I'll try and explain the minimum...
We have a "factless" fact table, that's related to all dimensions by a common key (many to one, bidirectional). For example:
Fact_table has columns KEY_Customer and KEY_Date.
Dim_Customer has columns KEY_Customer, CustomerID, Birthday, Gender.Dim_Date has columns KEY_Date
I also have my main [date] table written in DAX (Calenderauto()) which is related to Dim_Date (one to one, bidirectional) which I use to slice the data.
- AnonymousNot applicable
Can you share how the age grouping is done?