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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
PowerBIAdept1
New Member

Problem with Numbers and Dates

Hey there,

 

My Data looks Like this:

 

Date

5052021
7052021
7052021
5052021
7052021
7052021
10052021

 

The format should then look like this after the transformation with hopefully a m function: dd.mm.yyyy.

Please Help!

Thanks yall!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@PowerBIAdept1 

To change the number to date, please copy and past the following code into a blank query.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjUwNTIwMlSK1YlWMsfBJkaNoQGMEwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
    #"Split Column by Position" = Table.SplitColumn(Source, "Date", Splitter.SplitTextByPositions({0, 4}, true), {"Date.1", "Date.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Position",{{"Date.1", Int64.Type}, {"Date.2", Int64.Type}}),
    #"Split Column by Position1" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"Date.1", type text}}, "zh-CN"), "Date.1", Splitter.SplitTextByPositions({0, 2}, true), {"Date.1.1", "Date.1.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position1",{{"Date.1.1", Int64.Type}, {"Date.1.2", Int64.Type}}),
    #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type1", {{"Date.1.1", type text}, {"Date.1.2", type text}, {"Date.2", type text}}, "zh-CN"),{"Date.1.1", "Date.1.2", "Date.2"},Combiner.CombineTextByDelimiter(".", QuoteStyle.None),"Date"),
    #"Changed Type2" = Table.TransformColumnTypes(#"Merged Columns",{{"Date", type date}})
in
    #"Changed Type2"

Vpazhenmsft_0-1630289947575.png

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@PowerBIAdept1 

To change the number to date, please copy and past the following code into a blank query.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjUwNTIwMlSK1YlWMsfBJkaNoQGMEwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
    #"Split Column by Position" = Table.SplitColumn(Source, "Date", Splitter.SplitTextByPositions({0, 4}, true), {"Date.1", "Date.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Position",{{"Date.1", Int64.Type}, {"Date.2", Int64.Type}}),
    #"Split Column by Position1" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"Date.1", type text}}, "zh-CN"), "Date.1", Splitter.SplitTextByPositions({0, 2}, true), {"Date.1.1", "Date.1.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position1",{{"Date.1.1", Int64.Type}, {"Date.1.2", Int64.Type}}),
    #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type1", {{"Date.1.1", type text}, {"Date.1.2", type text}, {"Date.2", type text}}, "zh-CN"),{"Date.1.1", "Date.1.2", "Date.2"},Combiner.CombineTextByDelimiter(".", QuoteStyle.None),"Date"),
    #"Changed Type2" = Table.TransformColumnTypes(#"Merged Columns",{{"Date", type date}})
in
    #"Changed Type2"

Vpazhenmsft_0-1630289947575.png

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

mahoneypat
Microsoft Employee
Microsoft Employee

Here is one way to do it.  Add a custom column and put this expression in the pop-up box.

 

= let paddedtext = Text.PadStart([Date], 8, "0") in Text.Combine({Text.Start(paddedtext,2), ".", Text.Middle(paddedtext,2,2), ".", Text.End(paddedtext, 4)})

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on 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.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors
Top Kudoed Authors