Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

Datediff not working on all rows

I am calculating the number of months between two dates on a table of around 100,000 rows.

 

I'm using this forumula; Term.Months = DATEDIFF(Elements[Start Date],dateadd(Elements[End Date],1,day),MONTH)

 

About 1,500 rows are showing no results, blank.  I am getting good calcs for most of the rows; and the terms vary between 0 and 64 months.

 

3 Replies

  • shebr's avatar
    shebr
    Icon for Resolver III rankResolver III

    Hi Anonymous

     

    Can you post an image of some of the dates and columns with no data? the image you posted is cropped.

     

    Thanks

     

    shebr

    • Anonymous's avatar
      Anonymous
      Not applicable

      The image shows 3 columns, start.date, end.date and term; term is the column that is blank (the issue I'm experiencing).  The datediff calc uses the first two columns, to create the 3rd.

      • shebr's avatar
        shebr
        Icon for Resolver III rankResolver III

        Hi Anonymous

         

        Apologies I saw some items were cropped and assumed that was part of the column.

         

        Anyhow, fw things to check. Your PBI Desktop version, ensure you are up to date.

         

        Check your region settings in the Options section of your PBI desktop application. It could be that your dates are being determined as dd/mm/yyyy rather than mm/dd/yyyy. Also try changing the columns to a short date format (for testing purposes) to see if that helps.

         

        Let me know how you get on.

         

        Thanks

         

        shebr