Forum Discussion

MattAdams's avatar
MattAdams
Icon for Helper I rankHelper I
8 years ago
Solved

DAX query to compare two columns from different tables

I have a join on Column A and Column B, from respectively Table A and Table B. Both contain date values. From DAX via table A, I'd like to say if the date of Column B is to Column A or fell between the date of Column A and Column B , 1, else 0.

 

I can't seem to find the right function/formula to allow via DAX for any DAX queries to "see" column b from a DAX query within table A. Hopefully that makes sense. Many thanks in advance!

  • OK, I read that 3 times and I'm not following it. Can you explain it a different way? Sorry!

20 Replies

    • MattAdams's avatar
      MattAdams
      Icon for Helper I rankHelper I

      Thanks Greg_Deckler I see that RELATEDTABLE give you the option to reference another table, but how do I refer to tableB.columnB from tableA.columnA?

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

        Here's an example:

         

        Column = IF(RELATED('OtherTable'[ColumnB])=[ColumnA],1,0)

        You could also possibly use LOOKUPVALUE.