Forum Discussion

refint650's avatar
refint650
Helper III
3 years ago
Solved

difference between two date fileds

Hello All how to calcualte difference of days between two dates from two tables, Also what happenes if source columns values are expected nulls  how to handle this in logic.   Salesdate - sales ta...
  • v-xiaotang's avatar
    3 years ago

    Hi refint650 

    Thanks for reaching out to us.

    First, you need to find the dates you want to compare from the two tables, and then use the datediff function.

    for example, 

    measure= 

    var _date1= minx(filter(table1,table1[column1]="xxx"), [Salesdate])

    var _date2= minx(filter(table2,table2[column1]="xxx"), [Orderdate])

    return datediff(_date1,_date2,day)

     

    Best Regards,

    Community Support Team _Tang

    If this post helps, please consider Accept it as the solution to help the other members find it more quickly.