Forum Discussion
Relative age?
grggmrtn apologies but im struggling to understand what you looking for, surely it should be easy to get the age of the current year with a count? i dont quiet understand your challenge apologies if i am understanding you incorrectly
can you demonstrate what you expecting your visual to look like
vanessafvgI understand it's a bit complicated, sorry 🙂
I'm looking for a visualsation just like the one you show there, except that I need it to be a clustered column chart, with the year as axis.
So in the chart I've attached here, the x-axis is the year and age group, and the y-axis is the number of people. Same number of total people for each year, but of course they're all two years younger in 2018 than now, so the age group distribution will be different.
Is that making any more sense?
- grggmrtn6 years agoPost Patron
vanessafvgI think I'm going to have to end this thread with a "thanks for trying" - I'm beginning to realise that the complexity of the datamodel is going to make it pretty much impossible to explain the problem without sharing a LOT more than just dummy data, and that would break too many rules 😉
Sorry, but I really appreciate your effort anyhow 🙂
- vanessafvg6 years agoCommunity Champion
grggmrtn ok I get it, but the question is where is the relative date sitting, is that from the slicer? how does the relative date relate to the person? You obviously need to calculate it based on the relative year. But what is that relative year based on in your date? the date in dim date that is linked to your factless fact?
- Stachu6 years agoCommunity Champion
if I understand the problem correctly you have a star schema model, and you want to calculate the age of a customer based on a Calendar table rather than fixed value (TODAY()), is that correct?
try this codeRelative Age = VAR __CurrentDate = MAX(Dim_Date[KEY_Date]) DATEDIFF( MAX(Dim_Customer[Birthday]); __CurrentDate; YEAR )it should work as long as Year in the X axis is from the Dim_Date table