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

Data Shaping

Hello!

 

I am working with an example database that in the fact table has a date column with years 1900, 1901 and 1902. How can I change the years of this date column to other years (for example 2005,2006 and 2007) in the Query Editor, maintaining the day and the month?

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

This is my test table:

vyadongfmsft_0-1661335513580.png

 

Please change data type from “Date” to “Text”.

vyadongfmsft_1-1661335513585.png

 

Select Transform tab – Replace Values, enter the value you want to find and replace with.

vyadongfmsft_2-1661335513587.png

 

Then you can change the year and maintain the day and the month.

vyadongfmsft_3-1661335513588.png

 

Last, please remember to change data type from text to date.

vyadongfmsft_4-1661335513590.png

 

Best regards,

Yadong Fang

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

3 REPLIES 3
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

This is my test table:

vyadongfmsft_0-1661335513580.png

 

Please change data type from “Date” to “Text”.

vyadongfmsft_1-1661335513585.png

 

Select Transform tab – Replace Values, enter the value you want to find and replace with.

vyadongfmsft_2-1661335513587.png

 

Then you can change the year and maintain the day and the month.

vyadongfmsft_3-1661335513588.png

 

Last, please remember to change data type from text to date.

vyadongfmsft_4-1661335513590.png

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you very much for the detailed solution.

amitchandak
Super User
Super User

@Anonymous , In power query you can use

 

Date.AddYears([Date], 205)

 

Use on new column of transform the same column

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.