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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kdaya
Helper I
Helper I

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.pngrequest table will have mutiple dates for the customer and min_date table will have the min date for each customerrequest 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
Anonymous
Not applicable

-- 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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors