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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
EdK99
Frequent Visitor

Power Query Expresson.Error for Custom Date Column

Hello,

 

I built a report in Power BI and in Power Query I have a custom column that gives the date of 2 months after the order date.

the custom column code is: 

if[Order Date] is null then null else Date.AddMonths([Order Date],2)

 

Now I'm getting this error for some date values and I don't understand what the root of the issue is:

Column on the left is Order Date, column on the right is 2 Months From Order Date

Screenshot_59.png

the error is: 

Expression.Error: The Date value must contain the Date component.
Details:
15.01.2023

 

Could someone please help me figure this out?

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @EdK99 ,

 

My initial guess would be that your [Order Date] column is not formatted as Date Type.

Select the query step BEFORE you add your custom column. Select your [Order Date] column and, at the top of the column, click the icon at the left of the column header. Select Date as the type, so the icon changes to the little calendar you can see in my screenshot:

BA_Pete_0-1673943085901.png

 

If this doesn't work then it probably means Power Query can't parse your dates properly, so we'll have to fix that next.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @EdK99 ,

 

My initial guess would be that your [Order Date] column is not formatted as Date Type.

Select the query step BEFORE you add your custom column. Select your [Order Date] column and, at the top of the column, click the icon at the left of the column header. Select Date as the type, so the icon changes to the little calendar you can see in my screenshot:

BA_Pete_0-1673943085901.png

 

If this doesn't work then it probably means Power Query can't parse your dates properly, so we'll have to fix that next.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




EdK99
Frequent Visitor

That worked! I didn't pay attention to the order of steps in my power query. I changed the type in the step prior to the custom column and it removed the error.

 

Thanks a lot!!!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors