Forum Discussion

JCK2's avatar
JCK2
Helper III
5 years ago

Compare dates from two different tables

Hello Power BI Champions!!

 

I am trying to compare two dates from two tables and the relationship between the columns is active.

 

I wrote the following calculation to get 1 and 0.

 

Column=

If (Table1[Ticket Close Date]> Related Table2 [End of month],1,0)

 

but Im not getting 1 as a result? where am i going wrong?

 

* Also what will be the calculation, if the relationship is not active?  Thanks a lot!!

Table - 1                                                                                               Table-2

Ticket Close Date End of month
22/Sept/202031/08/2020
  

6 Replies

    • JCK2's avatar
      JCK2
      Helper III

      vanessafvg  I am not joining anything!

       

      I am trying to find out, which date is greater from the both tables and if its greater give me 1 else 0. 

       

      Thanks!

      • vanessafvg's avatar
        vanessafvg
        Community Champion
        why are you creating a column rather than a measures? ok if there is no relationship between the tables - what is the purpose of what you are doing so i can understand better, what is your objective?

        if you are just trying to get the max date from each table

        ie.
        isgreater =
        VAR maxtable1 =
        CALCULATE ( MAX ( table1[date] ) )
        VAR maxtable2 =
        CALCULATE ( MAX ( table2[date] ) )
        RETURN
        IF ( maxtable1 > maxtable2, 1, 0 )