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

Date not calculating correctly

Hi everyone,

 

I'm having a strange issue with a calculated date column and I was hoping you could help. I have a date, month, and year that I then consolidate into one column called "survey end date". The below example is showing the correct answer of 31/07/15:

 

Correct columns.PNG

 

 

Here's how the column is calculated:

 

Formula.PNG

 

The strange thing is that some answers are showing correctly, and some have the month and day switched around. In the below section of the results it's showing 04/09/19 instead of 09/04/19:

 

Columns.PNG

 

I can't think of what would cause this? They're from within the same data set so I can't see why some answers would be right and some wrong? The individual date, month, and year columns are formatted as whole numbers, and the Survey End Date column is formatted as date (dd/mm/yy).

 

Any help would be greatly appreciated!

 

Thanks

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Give this measure a try instead.

Survey end date = DATE ( Sheet[Survey end year], Sheet[Survey end month], Sheet[Survey end date])

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

Give this measure a try instead.

Survey end date = DATE ( Sheet[Survey end year], Sheet[Survey end month], Sheet[Survey end date])
Anonymous
Not applicable

Thanks so much - that seems to have fixed it!

Anonymous
Not applicable

Hey @Anonymous 

I have a theory.

When the day is 31 (or above 12) then it easy to know it is a day.

When it is 9 (or equal/below 12) the engine gets confused.

 

Try to wrap your code with the FORMAT() function.

Something like

Format(DATE,"dd/MM/yyy")

Let us know if it worked.

Thanks!
A

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.