Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I used this YouTube video - which I found it to be a great informative resource.
https://www.youtube.com/watch?v=JJFiPtmqPAg
I used this YouTube video - which I found it to be a great informative resource.
https://www.youtube.com/watch?v=JJFiPtmqPAg
Table.TransformColumns(Source, {"DateText", (x) => Date.FromText(x, [Format = "ddMMyyyy"])})
Since your values are text in DDMMYYYY format, Power BI won’t auto-detect them as dates. You need to explicitly parse them.
Do this in Power Query, not DAX.
Select the column
Transform → Extract → Text Range
Day: start 0, length 2
Month: start 2, length 2
Year: start 4, length 4
Add a Custom Column:
= #date(
Number.FromText([Year]),
Number.FromText([Month]),
Number.FromText([Day])
)
Set the new column’s type to Date
Remove the original text column if needed
let
Origen = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjA3MDcyMDJVitUBckwNzOAcQ1MDUwTH3MAEzjEyNTBGUmZoBOHEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Columna1 = _t]),
#"Tipo cambiado" = Table.TransformColumnTypes(Origen,{{"Columna1", type text}}),
Personalizado1 = Table.TransformColumns (#"Tipo cambiado",{{"Columna1", each Text.Combine ( Splitter.SplitTextByLengths({2,2,4})(_),"/")}}),
#"Tipo cambiado1" = Table.TransformColumnTypes(Personalizado1,{{"Columna1", type date}})
in
#"Tipo cambiado1"
Hi @agd50 ,
Please have a look at the code below. Let me know if this is what you required as the end product. Thanks!
Code:
let
Source = Table.FromRows(
Json.Document(
Binary.Decompress(
Binary.FromText("i45WMjA1NDIyMDJVitUBcwyROQZIHANLCCcWAA==", BinaryEncoding.Base64),
Compression.Deflate
)
),
let
_t = ((type nullable text) meta [Serialized.Text = true])
in
type table [Dates = _t]
),
Type = Table.TransformColumnTypes(Source, {{"Dates", type text}}),
DateType = Table.AddColumn(
Type,
"Date",
each #date(
Number.From(Text.End(_[Dates], 4)),
Number.From(Text.End(Text.Start(_[Dates], 4), 2)),
Number.From(Text.Start(_[Dates], 2))
)
),
ChangeLocaleToAus = Table.TransformColumnTypes(DateType, {{"Date", type date}}, "en-AU")
in
ChangeLocaleToAus
Regards,
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 6 | |
| 6 | |
| 5 |