cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MaheshGupta Frequent Visitor
Frequent Visitor

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 Member
Member

Re: calculate age difference between dates from two different tables

Hi @MaheshGupta 

Why dont you use just 

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

What kind of error you get?

MaheshGupta Frequent Visitor
Frequent Visitor

Re: calculate age difference between dates from two different tables

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

az38 Member
Member

Re: calculate age difference between dates from two different tables

@MaheshGupta 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?

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 294 members 3,463 guests
Please welcome our newest community members: