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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
yossi
New Member

Text To Date randomly switches days and months

I have columns that are looked up from different source, so I had to convert them into text in order to be able to look them up. Then when they were looked up I did new column with text to date using "dd/mm/yyyy". But it randomly uses format mm/dd and dd/mm.

 

I want to have them all as "dd/mm/yyyy". I am lost.

 

yossi_0-1679405587685.png

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

7 REPLIES 7
Ahmedx
Super User
Super User

Column = VAR _patch =SUBSTITUTE([Date],"/","|")
         VAR _Result =
          DATE(PATHITEM(_patch,3),PATHITEM(_patch,2),PATHITEM(_patch,1))
RETURN
if ( NOT ISBLANK([Date]),_Result,0)
Ahmedx
Super User
Super User

Screen Capture #706.pngScreen Capture #707.pngScreen Capture #708.pngScreen Capture #709.png

Thank you for your time and helping me, Ahmad. I was able also to solve it with quicker (or easier) formula:

Submission = IF(

    Source[Submission TEXT] = "",0,

    DATE(

        RIGHT(Source[Submission TEXT],4),

        MID(Source[Submission TEXT],4,2),

        LEFT(Source[Submission TEXT],2)))

yossi
New Member

yossi_0-1679410358725.png

 

Ahmedx
Super User
Super User

Screen Capture #700.png

Ahmedx
Super User
Super User

Screen Capture #699.png

But how do I do that in Dax? Lookup is done in Table tab in Dax, so I don't have these columns in Power Query.

 

To convert I used this formula:

 

Submission Date = IF(

    Source[Submission TEXT] = "",0, DATEVALUE(FORMAT(Source[Submission TEXT], "DD/MM/YYYY")))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors