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

Query Editor - Transformation - Replace values: use of wildcard

Hi There, 

I've got a table with 2 columns year and month. I need to add a column with a specific date format. I can do so by adding a column to the table itself in using Date(year([year]), month([month],1) for example. My question is which formula to use if I want to add this date field in power query editor. "Date" appears to not be recognised. 

 

thanks!

1 ACCEPTED SOLUTION

Hi @Anonymous ,

What is your desired result? If you just want to create a custome date with your [Year] and [Month] columns, you could refer to below formula in query editor:

#date([Year],[Month],1)

Result:

1.PNG

You could also refer to date function in M:

https://docs.microsoft.com/en-us/powerquery-m/date-functions

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Buzz1126
Helper III
Helper III

I think the easiest way to do this is by creating a Date Table.

 

Go to Modeling at the top -> New table

 

At the top enter:

 

DATE = CALENDAR(DATE(2011,1,1), DATE(2019,12,31))
'You can change the 2011/2019 dates to whatever you want.  

This will create a date data table, link it to your data throgh relationships and you'll be good to go.

Anonymous
Not applicable

thanks for your response. my problem is however that my table only contains the columns 'year' and 'month' and I need to add a custom column in date format.  I have a calendar table to which I want to link my table, using this additional column I'm struggling to create. 

 

Hi @Anonymous ,

What is your desired result? If you just want to create a custome date with your [Year] and [Month] columns, you could refer to below formula in query editor:

#date([Year],[Month],1)

Result:

1.PNG

You could also refer to date function in M:

https://docs.microsoft.com/en-us/powerquery-m/date-functions

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

thanks for that, I had tried this, but overlooked the case sensitivy of the date function. am all set now. 

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.