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

changing date format from text to date

Hello,

 

I am creating a dashboard to be able to show controls that are expiring withing a certain period of time. This is my code:

nabilc02_0-1657734884729.png

For this code to work with my data, the 'ITRMP Controls'[Expiration Date] has to be in a date format. Whenever I add this code to my data to try and sort my data this is the error I get:

nabilc02_1-1657735002857.png

Whenever I try to change the data type or format from text to date type I get an error saying "We can't automatically convert the column to date type"

 

Also, the expiration date in the excel sheet is in DMY (Day/ Month/ Year) format

 

I am fairly new to PowerBI, so please explain as simple and thoroughly as possible.

 

Thank you

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

Hi @Anonymous ,

 

You need to add a custom column to convert the date to dd/mm/yyyy format in Power Query Editor. Then convert the Custom column to date type.

 

= let mylist = Splitter.SplitTextByDelimiter("/")([Date])
in Text.Combine({mylist{1}, mylist{0},mylist{2}},"/")

vkkfmsft_0-1658127485285.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need to add a custom column to convert the date to dd/mm/yyyy format in Power Query Editor. Then convert the Custom column to date type.

 

= let mylist = Splitter.SplitTextByDelimiter("/")([Date])
in Text.Combine({mylist{1}, mylist{0},mylist{2}},"/")

vkkfmsft_0-1658127485285.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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 it worked!

HotChilli
Super User
Super User

You have to find the correct way of getting the Expiration Date into a date type.  Power Query has lots of different functions to handle this.

Please provide some sample data to see what we're dealing with.

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.