Forum Discussion
Date in a colums
- 5 years ago
Anonymous
Your data looks like this before extracting the dateRight-click on the Column Header > Choose Transform and select TRIM
Then Click ADD COLUMN ribbon > CUSTOM COLUMN and paste the below code.=if Text.Length([Dates]) = 14 then #date(Number.From(Text.Middle([Dates],6,2)),Number.From(Text.Middle([Dates],3,2)),Number.From(Text.Middle([Dates],0,2))) else Date.FromText(Text.Middle([Dates],8,2) &"." & Text.Middle([Dates],4,3)&"."&Text.End([Dates],2))Change the Type to Date
You can apply any formatting in Power BI Model.________________________
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 🙂
Anonymous
It seems your data is not in a uniform pattern, the 1st three rows are different from the rest. Can you confirm if this the way your data is saved?
________________________
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 🙂
Yes !Half of the data in this column look likes the first three rows , the second half is like the rest.
- CNENFRNL5 years agoCommunity Champion
Anonymous Ok, then, just tweak the code with appointing the "Source" to your file; and the rest will be coped with by the code.
- Fowmy5 years agoSuper User
Anonymous
Your data looks like this before extracting the dateRight-click on the Column Header > Choose Transform and select TRIM
Then Click ADD COLUMN ribbon > CUSTOM COLUMN and paste the below code.=if Text.Length([Dates]) = 14 then #date(Number.From(Text.Middle([Dates],6,2)),Number.From(Text.Middle([Dates],3,2)),Number.From(Text.Middle([Dates],0,2))) else Date.FromText(Text.Middle([Dates],8,2) &"." & Text.Middle([Dates],4,3)&"."&Text.End([Dates],2))Change the Type to Date
You can apply any formatting in Power BI Model.________________________
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 🙂
- Anonymous5 years agoNot applicable
Big thanks!
Can i ask you to help me last time? You code is work ! Can you little bit change him that consider last :00
Now it loks like
P.S Sorry for bad english 🙂