Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello all,
I'm fairly new to powerBi and I couldn't figure out how to get this working in power Query.
I have a dataset like this:
| Source.Name | DeviceCount |
| Devices20230508.json | 215 |
| Devices20230509.json | 213 |
| Devices20230510.json | 218 |
| Devices20230511.json | 221 |
As you can see, the Source.Name is time stamped (8th of may, 9th of may, etc.) I want to generate a time column based on the content of the Source.Name column. Below would be my desired result:
| Source.Name | DeviceCount | Time Generated |
| Devices20230508.json | 215 | 2023-05-08 |
| Devices20230509.json | 213 | 2023-05-09 |
| Devices20230510.json | 218 | 2023-05-10 |
| Devices20230511.json | 221 | 2023-05-11 |
Any help would be greatly appreciated. Thanks!
Solved! Go to Solution.
Hi @Anonymous ,
Add this as a new custom column:
let numbers = Text.Select([Source.Name], {"0".."9"}) in
#date(
Number.From(Text.Start(numbers, 4)),
Number.From(Text.Middle(numbers, 4, 2)),
Number.From(Text.End(numbers, 2))
)
For this output:
Full example query:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wckkty0xOLTYyMDI2MDWw0Msqzs9TitVBljAyNDIyhUrEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source.Name = _t]),
addTimeGenerated =
Table.AddColumn(
Source,
"Time Generated",
each let numbers = Text.Select([Source.Name], {"0".."9"}) in
#date(
Number.From(Text.Start(numbers, 4)),
Number.From(Text.Middle(numbers, 4, 2)),
Number.From(Text.End(numbers, 2))
)
)
in
addTimeGenerated
Pete
Proud to be a Datanaut!
Hi @Anonymous ,
Add this as a new custom column:
let numbers = Text.Select([Source.Name], {"0".."9"}) in
#date(
Number.From(Text.Start(numbers, 4)),
Number.From(Text.Middle(numbers, 4, 2)),
Number.From(Text.End(numbers, 2))
)
For this output:
Full example query:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wckkty0xOLTYyMDI2MDWw0Msqzs9TitVBljAyNDIyhUrEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source.Name = _t]),
addTimeGenerated =
Table.AddColumn(
Source,
"Time Generated",
each let numbers = Text.Select([Source.Name], {"0".."9"}) in
#date(
Number.From(Text.Start(numbers, 4)),
Number.From(Text.Middle(numbers, 4, 2)),
Number.From(Text.End(numbers, 2))
)
)
in
addTimeGenerated
Pete
Proud to be a Datanaut!
Hi Pete,
Awesome, thank you so much for your help! You saved me a lot of headache!
Tim
Check out the April 2026 Power BI update to learn about new features.
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.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |