Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Data comparison on two tables in direct query

Hi Gurus,

 

     I have  "created_date" in table A , "updated_date" in table B , data has been pulled through Direct query. Now i need to compare both the date fields from different tables as mentioned below.

 

  if( created_date > updated_date)

 then (created_date ) 

 else (updated_date).

 

1) Is it possible to achieve this scenario with direct queries

2) Basically am trying to find the maximum date by comparing these two dates. Any suggestion

 

Thanks,

Shamar

  • Hi Anonymous,

     

    Try this measure.

     

    Measure =
    IF (
        MAX ( 'Table_3'[create date] ) > MAX ( 'Table_4'[update date] ),
        MAX ( 'Table_3'[create date] ),
        MAX ( 'Table_4'[update date] )
    )

     

    Best  Regards,

    Cherry

4 Replies

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi Anonymous,

     

    By my tests, you could create the measure to compare the two date from different tables in Direct Query.

     

     

    Best Regards,

    Cherry

    • Anonymous's avatar
      Anonymous
      Not applicable

      v-piga-msft : Can you please explain a bit more to get clarity or can u pls share the code

      • v-piga-msft's avatar
        v-piga-msft
        Icon for Resident Rockstar rankResident Rockstar

        Hi Anonymous,

         

        Try this measure.

         

        Measure =
        IF (
            MAX ( 'Table_3'[create date] ) > MAX ( 'Table_4'[update date] ),
            MAX ( 'Table_3'[create date] ),
            MAX ( 'Table_4'[update date] )
        )

         

        Best  Regards,

        Cherry