Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

DateDiff DAX Error

I have to create the datediff between the 'project from date' and 'today' in days. 
However I am not able to specify 1st date parameter column.

Is there a way I can calculate difference between 2 dates?

  • Hi Anonymous ,

     

    There are two solutions:

     

    1.Please create a new column:

     

    Column = DATEDIFF('Table'[project from date],TODAY(),DAY)

     

     

    2.Please create a new measure:

     

     

    gap = DATEDIFF(MAX('Table'[project from date]),TODAY(),DAY)

     

     

    Best regards,

    Yadong Fang

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

5 Replies

  • Anonymous ,Try this

    DATEDIFF(TableName[Proj Start Date Column],Today(),DAY)

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      I tried that, but I am not able to add the first date parameter is i.e. 'Project From Date' column.

      • tamerj1's avatar
        tamerj1
        Community Champion

        Hi Anonymous 
        Please try
        DATEDIFF ( SELECTEDVALUE ( TableName[Proj Start Date Column] ),  Today ( ), DAY )

  • v-yadongf-msft's avatar
    v-yadongf-msft
    Community Support

    Hi Anonymous ,

     

    There are two solutions:

     

    1.Please create a new column:

     

    Column = DATEDIFF('Table'[project from date],TODAY(),DAY)

     

     

    2.Please create a new measure:

     

     

    gap = DATEDIFF(MAX('Table'[project from date]),TODAY(),DAY)

     

     

    Best regards,

    Yadong Fang

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

  • v-yadongf-msft's avatar
    v-yadongf-msft
    Community Support

    Hi Anonymous ,

     

    Has your problem been solved? If solved, please consider Accept it as the solution to help the other members find it more quickly.