Forum Discussion
Date format from text
- 6 years ago
Anonymous
yes.
try
Column = IF(ISBLANK([DATE]), BLANK(), DATE(VALUE(RIGHT([DATE], 2)) + 2000, VALUE(LEFT([DATE], LEN([DATE])-4)), VALUE(MID([DATE],LEN([DATE])-3,2))) )
You can parse this out with DAX text functions, but this is a great application of Column from Examples in the power query editor. Please see this link - https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-add-column-from-example
I used it on similar data and it automatically created a custom column with this M expression
Text.Combine({Text.Reverse(Text.Middle(Text.Reverse(Text.From([Date], "en-US")), 4)), "/", Text.Reverse(Text.Middle(Text.Reverse(Text.From([Date], "en-US")), 2, 2)), "/20", Text.End(Text.From([Date], "en-US")
If you still want to do it with DAX, here is one way to do it
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- Anonymous6 years agoNot applicable
Thanks mahoneypat for the insightful information!
When I tried to use the DAX statement I get this error.