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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
PStokes
Frequent Visitor

convert 7 character text DMMYYY and 8 character text DDMMYYYY column to date

 
1 ACCEPTED SOLUTION

sorry saw my syntax error and corrected it.

This worked if I chnaged the MID expression to  MID('table'[date],2,2) for 7 character dates and MID('table'[date],3,2) for 8 character dates

successful formulae below

thank you very much

 
Date =
VAR _length = LEN('table'[date])
RETURN IF(_length=7,DATE(RIGHT('table'[date],4),MID('table'[date],2,2),LEFT('table'[date],1)),DATE(Right('table'[date],4),MID('table'[date],3,2),LEFT('table'[date],2)))

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@PStokes Please try below formula. in case it doesn't work for you please share two three record for each formate

DDMMYYYY = DATE(RIGHT('Table'[Date],4),MID('Table'[Date],3,2),LEFT('Table'[Date],2))

 

In case of DMMYYYY please check the length of column and if it is 8 then you can use above else

dMMYYYY = 
VAR _length = len('table'[column])
RETURN IF(_length=7,DATE(RIGHT('Table'[Date],4),MID('Table'[Date],3,2),LEFT('Table'[Date],1)),DATE(RIGHT('Table'[Date],4),MID('Table'[Date],3,2),LEFT('Table'[Date],2)))

Thanks, I tried to add colum and use the VAR as written but received a sytax error

Examples of the data below. 

Date Text
1012019
21012019
27112019
8112019

sorry saw my syntax error and corrected it.

This worked if I chnaged the MID expression to  MID('table'[date],2,2) for 7 character dates and MID('table'[date],3,2) for 8 character dates

successful formulae below

thank you very much

 
Date =
VAR _length = LEN('table'[date])
RETURN IF(_length=7,DATE(RIGHT('table'[date],4),MID('table'[date],2,2),LEFT('table'[date],1)),DATE(Right('table'[date],4),MID('table'[date],3,2),LEFT('table'[date],2)))

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.