Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Extract date and time from google analytics table

I import Table with Data time from Google Analytics in a format like this:

Galat198_0-1610382185781.png

When I try to extract with a split button: year, month, day, hour, the moment I get errors. Because after extracting 4 numbers of a year, the first zero is deleted

Galat198_1-1610382401290.png

Then I get a different number of numbers that I do not know how to deal with to get a date and time separately...
Do you have any idea how to extract data from such a format?

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

You may apply the following steps in Power Query. Here are m codes in 'Advanced Editor'.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjA0MrIwMjQ0UIrVQQgYAkVgAoYGhgamRobGZsgChkB1FkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date Hour and Minute" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date Hour and Minute", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Year", each Number.From( Text.Start([Date Hour and Minute],4))),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Month", each Number.From( Text.Middle([Date Hour and Minute],4,2))),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Day", each Number.From( Text.Middle([Date Hour and Minute],6,2))),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "Hour", each Number.From( Text.Middle([Date Hour and Minute],8,2))),
    #"Added Custom4" = Table.AddColumn(#"Added Custom3", "Minute", each Number.From( Text.End([Date Hour and Minute],2)))
in
    #"Added Custom4"

 

Result:

a2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

You may apply the following steps in Power Query. Here are m codes in 'Advanced Editor'.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjA0MrIwMjQ0UIrVQQgYAkVgAoYGhgamRobGZsgChkB1FkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date Hour and Minute" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date Hour and Minute", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Year", each Number.From( Text.Start([Date Hour and Minute],4))),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Month", each Number.From( Text.Middle([Date Hour and Minute],4,2))),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Day", each Number.From( Text.Middle([Date Hour and Minute],6,2))),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "Hour", each Number.From( Text.Middle([Date Hour and Minute],8,2))),
    #"Added Custom4" = Table.AddColumn(#"Added Custom3", "Minute", each Number.From( Text.End([Date Hour and Minute],2)))
in
    #"Added Custom4"

 

Result:

a2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous ,

try like Date.FromText(Text.Start([datehourtime],8))

Date.FromText(Text.Start([datehourtime] & "" ,8))

Or

Date.FromText(Text.Start([datehourtime] ,2) & " " & Text.Middle([datehourtime] ,4,2)& " " & Text.Middle([datehourtime] ,6,2))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.