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
newuser101
New Member

Unable to transform Month and Year from a text field to date field

When importing my data it has identified my date field as a text field. The option to transform my data from text to date seems to be greyed out and as a result my trend lines are not working correctly (alphabetical rather than chronological.)

 

Any idea how to fix this/why this is happening?

newuser101_2-1668432606597.png

 

 

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

Hi @newuser101 ,

 

If the "Month" and "Year" are separate columns, it will show as "text" and "whole number" in Power BI Desktop. And you can't convert them into a DATE type or use FORMAT function to change the type. It may show an "error". 

vxiaosunmsft_0-1668481172244.png vxiaosunmsft_1-1668481189770.png  vxiaosunmsft_2-1668481205908.png

If you have at least two parameters such as month-year, you can convert it to DATE type.

vxiaosunmsft_3-1668481531240.png

You can reference the following document.

Data types in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,
Community Support Team _ xiaosun

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

2 REPLIES 2
v-xiaosun-msft
Community Support
Community Support

Hi @newuser101 ,

 

If the "Month" and "Year" are separate columns, it will show as "text" and "whole number" in Power BI Desktop. And you can't convert them into a DATE type or use FORMAT function to change the type. It may show an "error". 

vxiaosunmsft_0-1668481172244.png vxiaosunmsft_1-1668481189770.png  vxiaosunmsft_2-1668481205908.png

If you have at least two parameters such as month-year, you can convert it to DATE type.

vxiaosunmsft_3-1668481531240.png

You can reference the following document.

Data types in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,
Community Support Team _ xiaosun

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

timg
Solution Sage
Solution Sage

Hi,

Can you check whether the datatype is set to "whole number"? This could be the issue.

1.PNG

Best regards,

 

Tim





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.