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
Anonymous
Not applicable

Get date from string

Hello,

I have a string in the below format

Chandra_Va_1-1598723310045.png

Im trying to get from and to dates in 2 separate column's in DAX but no luck.

 

Chandra_Va_0-1598723286166.png

and

Chandra_Va_0-1598723778514.png

 

Any one have idea, how to deal with this.

 

Thanks

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Well, I would use split in Power Query on the hyphen, that would be easiest, but if you really want a DAX solution:

 

From = DATEVALUE(MID([Column1],1,FIND("-",[Column1])-1))

To = DATEVALUE(MID([Column1],FIND("-",[Column1])+1,LEN([Column1])))

 

PBIX is attached below sig, Table 24. 



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...
Anonymous
Not applicable

Thank you for Helping me.

Unfortunately, it is with BLANK's in Dates Range causing the issue. The BLANK is taken care and now the DAX works well.

 

Thank you

Fowmy
Super User
Super User

@Anonymous 

Add two columns: Change the data type to Date once you have added the columns.

Date1 = 
LEFT('Table'[String],SEARCH("-",'Table'[String])-1)
Date2 = 
RIGHT('Table'[String],SEARCH("-",'Table'[String])-1)

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.

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.