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! Learn more

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
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.