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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Ronning
Frequent Visitor

Subtracting two date columns in two different tables

Hi, I have a problem with subtracting two date columns from different tables. 

I have tried this.       DATEDIFF(  SUM( 'Table' [Column] ) , SUM( 'Table' [Column]) , DAY ).

But when i drag this measuer into a table it gives me this message.

" An unvalid numerical representation of a datevalue has occoured"

Could this be because thera are some future date in one column that dosent exist in the other ? 

 

 

Thanks

1 ACCEPTED SOLUTION

I found out the problem... It was just to change SUM to MAX.

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Ronning 
If there is a relationship between th etwo tables then if table1 is at the many side and table2 is at the one side and assuming that 'Table1'[Column] is the earlier date and 'Table2'[Column] is the later date then you can use

# Days =
SUMX (
    'Table1',
    DATEDIFF ( 'Table1'[Column], RELATED ( 'Table2'[Column] ), DAY )
)

 

 

I found out the problem... It was just to change SUM to MAX.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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