Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
4 years ago
Solved

compare 2 dates from different tables

Hello, I would really appreciate the help.

I have 2 tables with custom columns

darcas2012_0-1649229860864.png

I need to compare those 2 dates and get the difference in months and that I stay in Table 1 I do not know if as a column or as a measure, because then I need to calculate which ones have more than 6 months for the fulfillment of an indicator. For example:

darcas2012_1-1649229968318.png

  • Hi Syndicate_Admin ,


    Try to create a new column like below:

    Column = 
    var date_ = LOOKUPVALUE('Table 2'[FechaRegistro],'Table 2'[ID],'Table 1'[ID])
    return DATEDIFF(date_,'Table 1'[Fechasolucion],MONTH)

    If you want to save the dates in Table 2 in Table 1, create this column:

    Column 2 = LOOKUPVALUE('Table 2'[FechaRegistro],'Table 2'[ID],'Table 1'[ID])

     


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

2 Replies

  • Syndicate_Admin ,

    we can get a new column in table 1 the date of table 2 based on ID

     

    Date table 2 = maxx(filter(Table2, Table2[ID] = Table1[ID]), Table2[Date])

     

    Usually, we create a common date table and join it with date of both tables and use that

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi Syndicate_Admin ,


    Try to create a new column like below:

    Column = 
    var date_ = LOOKUPVALUE('Table 2'[FechaRegistro],'Table 2'[ID],'Table 1'[ID])
    return DATEDIFF(date_,'Table 1'[Fechasolucion],MONTH)

    If you want to save the dates in Table 2 in Table 1, create this column:

    Column 2 = LOOKUPVALUE('Table 2'[FechaRegistro],'Table 2'[ID],'Table 1'[ID])

     


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