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

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.

Reply
Anonymous
Not applicable

calculate age difference between dates from two different tables

Hi There,

 

I've been trying find the ageing of Opportunities based on the create and close date of them, however, in order to get the desired result I need to take the values from two different tables which are already linked (has a relation). Here's the DAX column I've tried:

 

Opp_Age = IF(
ISERROR(DATEDIFF('Opportunity History'[CreatedDate], RELATED(Opportunity[CloseDate]),MONTH)),
DATEDIFF(RELATED(Opportunity[CloseDate]),'Opportunity History'[CreatedDate], MONTH))
 
I'm getting a balnk column as a result.
 
Ant help on this would be appriciated!!! Thanks in advance.
3 REPLIES 3
az38
Community Champion
Community Champion

Hi @Anonymous 

Why dont you use just 

Opp_Age = 
DATEDIFF('Opportunity History'[CreatedDate]; RELATED(Opportunity[CloseDate]);MONTH)

What kind of error you get?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38 Thank you for your prompt response. This formula isn't working as the close date is not being taken by the DAX.

az38
Community Champion
Community Champion

@Anonymous why? what error you see?

pbiDates.PNG

for what table you add the column? i added it for Opportunity History? what kind of relations between the tables do you use?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors