Forum Discussion

Ronning's avatar
Ronning
Frequent Visitor
4 years ago
Solved

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

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

2 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

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

     

     

    • Ronning's avatar
      Ronning
      Frequent Visitor

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