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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
YBZ
Helper III
Helper III

error converting text to date

Hi all,

 

I have an error with below sample data to convert a text column (Period) to a date format (Date period).

 

PeriodDate period
004.202101.04.2021
005.202101.05.2021
006.202101.06.2021

 

The Date Period I retrieved via following formula : 
Date Period = CONCATENATE("01.";right('DataFile'[Period];7))

 
Now when I would like to convert the Date Period column to date (dd.mm.year), it says that it cannot convert the value to Date format.
 
Any support is much appreciated,
 
Kind regards
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@YBZ Perhaps try:

Date column =
  VAR __Day = LEFT([Date period],2)
  VAR __Month = MID([Date period],4,2)
  VAR __Year = RIGHT([Date period],4)
RETURN
  DATE(__Year,__Month,__Day)

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@YBZ Perhaps try:

Date column =
  VAR __Day = LEFT([Date period],2)
  VAR __Month = MID([Date period],4,2)
  VAR __Year = RIGHT([Date period],4)
RETURN
  DATE(__Year,__Month,__Day)

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

thanks Greg, it works! 🙂

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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