Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Date difference calculation

Hi,

 

I want the numbers of whole days difference between two dates, the required date and the transaction date. Both are in two different tables. The tables are joined by an ID on workorder ID, operation sequence and item ID. I tried to build a column based formula on DATEDIFF which is the following: Date_diff = [REQUIRED_DATE].[Date]-MIN([TRANSACTION_DATE].[Date]). Result is a number which I cannot interpretate. Of course first line should be 0, third line should be 1.

 

Any help is highly appreciated. Thanks in advance

 

  •  Just create an example with several rows of similar data

10 Replies

  • Hi Anonymous 

    Is there a pbix you could attach?
    From the picture, it's hard to tell what was done.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Data source is directly on our ERP system, import mode. How can I share?

      • Ritaf1983's avatar
        Ritaf1983
        Super User

         Just create an example with several rows of similar data

  • DOLEARY85's avatar
    DOLEARY85
    Resident Rockstar

    Hi,

     

    would the datediff function work istead of using minus between 2 dates?

     

    DATEDIFF('Table1'[Date],min('Table2'[Date]),DAY)
     
    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Doleary85,

       

      Power BI accepts formula, however Power BI does not end calculating. Does not show data. Is there an alternative?

      • DOLEARY85's avatar
        DOLEARY85
        Resident Rockstar

        Can you share a screenshot of what's happening?