cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kdaya Regular Visitor
Regular Visitor

DATEDIFF Cross table with many to one table relationship

Hi Community,

 

Please can you assist i am trying to subtract two dates from two different tables which have a many to one relationship

 

I have tried using RELATE but i think cause of the one to many relation that does not work

 

basically trying to subtract the min date for each account by all the dates for that account to get the days

 

2019-08-15 00_04_01-Support Customer Reporting - Power BI Desktop.png2019-08-15 00_11_47-FD - Excel.pngrequest table will have mutiple dates for the customer and min_date table will have the min date for each customerdays

 

thanks in advance

 

 

 

1 REPLY 1
Super User
Super User

Re: DATEDIFF Cross table with many to one table relationship

-- If you have a 1:many rel between
-- min_date and requests, then this
-- will work

[Days Since First Date] = -- calculated column in requests
var __thisDate = requests[Created Time]
var __firstDate = RELATED( min_date[First Date] )
return
	__thisDate - __firstDate

 

Please note that such calculations should be performed in Power Query, not in DAX.

 

Best

Darek

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 224 members 1,719 guests
Please welcome our newest community members: