Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
homeshagarwal
Regular Visitor

Calculating Customer Age at the time of Transaction

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:

homeshagarwal_0-1687492839316.png

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?

2 ACCEPTED SOLUTIONS

@homeshagarwal 

Please try

Customer Age =
DATEDIFF (
    RELATED ( 'Customer Lookup'[Date of Birth] ),
    'Sales by Store'[Transaction Date],
    YEAR
)

View solution in original post

devanshi
Helper V
Helper V

Age = DATEDIFF('Table'[Birthdate], 'Table'[Transaction Date],YEAR)

View solution in original post

5 REPLIES 5
homeshagarwal
Regular Visitor

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.

devanshi
Helper V
Helper V

Age = DATEDIFF('Table'[Birthdate], 'Table'[Transaction Date],YEAR)

tamerj1
Super User
Super User

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.

@homeshagarwal 

Please try

Customer Age =
DATEDIFF (
    RELATED ( 'Customer Lookup'[Date of Birth] ),
    'Sales by Store'[Transaction Date],
    YEAR
)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.