Forum Discussion

Amitkr174's avatar
Amitkr174
Icon for Helper III rankHelper III
7 years ago

How to find a difference between two dates which has no relation???

Hi,

Could someone please explain how to find a difference between two dates which has no relation??

I have two tables Project and opportunity which has no relation.

I am using the below DAX

Days Diff=

VALUE( DATEDIFF(LASTNONBLANK(Project[Project Start Date],1),LASTNONBLANK(Opportunity[Close Date],1),DAY))

4 Replies

  • TeigeGao's avatar
    TeigeGao
    Icon for Solution Sage rankSolution Sage

    Hi Amitkr174,

    Based on my test, we can use the following DAX if two dates has no relation.

    Days Diff = DATEDIFF(LASTNONBLANK(Project[Project Start Date],1),LASTNONBLANK(Opportunity[Close Date],1),DAY)

    The result will like below:

    Best Regards,

    Teige

    • Amitkr174's avatar
      Amitkr174
      Icon for Helper III rankHelper III

      Hi,

       

      This is not wokring where objects has no relation. I aleady tried this DAX, but it is not giving me the expected results.

      I using direct query here on which I have no control. 

      • TeigeGao's avatar
        TeigeGao
        Icon for Solution Sage rankSolution Sage

        Could you please share the pbix to us for analysis? In my environment, it works.