Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

DAX Date Function (Datediff) cross table

Hi there,

 

I have two tables as sources in my report. Now I want to use datediff function on two dates one located in on the other in the other table. Somehow it doesnt seem to support this. 

 

Days Subscribe/Book = DATEDIFF(Table1[dateCreated];Table2[Opt-in time];day)
 
Autocomplete just doesnt offer my the Table2, although tables are correcty joined.
 
Any Idea?

6 Replies

  • Anonymous  is it one to many relationship? if yes, you can use RELATED function to get date from one side of table relationship.

    • Anonymous's avatar
      Anonymous
      Not applicable

      parry2k Hi there, yes it is a one to many relationship. How will then the syntax look like in my example?

      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        Anonymous  try following, assuming table2 is on one side of the relationship.

         

        Days Subscribe/Book = DATEDIFF(Table1[dateCreated];related(Table2[Opt-in time]);day)
  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi Anonymous ,

     

    By my tests, the suggestion of parry2k should be helpful.

     

    If you have solved your problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

     

    If you still need help, please share your data sample and your desired output so that we could help further on it.

     

    Best Regards,

    Cherry