Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all!
Need help with a DAX code to create a calculation to find out the Customer's Age at the date of the transaction and not as per TODAY. The following is my data model:
My Customer Table and Sales Table are connected based on Customer ID and not on a Date Field.
Could you please help me out here?
Solved! Go to Solution.
Please try
Customer Age =
DATEDIFF (
RELATED ( 'Customer Lookup'[Date of Birth] ),
'Sales by Store'[Transaction Date],
YEAR
)
Age = DATEDIFF('Table'[Birthdate], 'Table'[Transaction Date],YEAR)
Thanks, @tamerj1 !🙌
This was pretty straightforward. Do you know where I messed up?
For some reason, I was trying to add a new column in the Customer's table with this formula earlier 😅😂 so wasn't getting it.
Age = DATEDIFF('Table'[Birthdate], 'Table'[Transaction Date],YEAR)
Hi @homeshagarwal
So are looking for a calculated column in the Sales table or a measure in report sliced by transaction? Do you have date of birth column for each customer or just the current age of the customer in years?
Hi @tamerj1
I'm looking to include a Calculated Column in my Sales table to specify the customers' age at the time of the transaction. Also, yes, I do have a Birthdate column in the Customer's table.
Please try
Customer Age =
DATEDIFF (
RELATED ( 'Customer Lookup'[Date of Birth] ),
'Sales by Store'[Transaction Date],
YEAR
)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 20 | |
| 11 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 29 | |
| 21 | |
| 12 | |
| 12 |