Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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.

DatediffIssue.PNG

 

3 REPLIES 3
shebr
Resolver III
Resolver 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
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.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.