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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Month column not properly formatted

Hi,

 

I have monthly data imported for 10 months from 10 excel sheets from which the Month was extracted from the file names using "Text between Delimiters", the data type of the Month column is text. The column is Month and the values are - 

Apr20, Mar20, Feb20, Jan20, Dec19, Nov19, Oct19, Sep19, Aug19, Jul19.

 

When I change the format to Date, the values from Dec19 to Jul19 become Dec20,.....,Jul20. 

 

Please help with this.

 

Thanks,

Vishy

6 REPLIES 6
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

I tried to reproduce your issue, but it failed.It works as expected.

test_Month column not properly formatted.PNG

Can you share some screenshots and M query code?

 

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

Anonymous
Not applicable

Hi @V-lianl-msft ,

 

PFA the sample pbix along with the sample data files with the file names similar to how it actually is.

https://drive.google.com/file/d/1jyfzuN5JNOhju2qAkZNiH17uGwvSRrEg/view

 

I am facing the same issue above where the Dec19 (i.e. Dec 2019) file name gets converted to Dec20 when I change the data type to Date.

 

Let me know if you have any questions.

 

Thanks,
Vishy

amitchandak
Super User
Super User

@Anonymous , Try like

=Text.start([date],3) & (Text.End([date],2)*1+1)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak ,

 

That didn't work. Let me try giving you some more details on this column. As I mentioned, I am importing data from 10 different excel sheets. Sample file name of these excel sheets are "XYZ_Apr20", "XYZ_Mar20" and so on.

 

I created a Month column using "Text between Delimiters" as mentioned before to just get the Month and Year so my Month column has values Apr20, Mar20 and so on. The data type of this column is Text. When I change the data type to Date, Jul19 to Dec19 becomes Jul20 to Dec20 which is incorrect.

 

Hope this gives the required info, let me know if you have additional questions.

 

Regards,

Vishy 

amitchandak
Super User
Super User

@Anonymous , Make them a date column

 

Date = "01-" & left([Month],3) & "-" & right([Month],2)

 

Mark that as date , then try

 

Date new= date(year([Date])+1,month([Date]),Day([Date]))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak ,

 

I believe the solution suggested by you is with DAX. Is there any way to do it in the Query Editor itself before loading the data?

 

Regards,

Vishy

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.