cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
New Ranks and Rank Icons in 2020

New Ranks and Rank Icons in 2020

Read the announcement for more information!

New Kudos Given Badges Coming

New Kudos Given Badges Coming

We're rolling out new Kudos Given badges. Find out how many Kudos you've given.

November 2019 Community Highlights

November 2019 Community Highlights

Get an overview of the events and great community content from November.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)