Forum Discussion
grggmrtn
6 years agoPost Patron
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 perfect...
grggmrtn
6 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 🙂
Stachu
6 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 code
Relative 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