cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
bajimmy1983 Member
Member

How to Add a Custom Column Date like (01-01-16, 01-02-16, etc)

Hello again community.

 

I think this very simple, but I cannot reach this outcome using Power Query (Add Custom Column feature). Cal you help me?

 

In one table I have Columns:

DAY = 01;

MONTH = 01, 02, 03 and so on; 

YEAR = 2016

 

Outcome: A Custom column that joins all three columns above and shows in date format DD-MM-YY (01-01-2016, 01-02-2016, 01-03-16

 

I have tried M lamguage = [DAY] & "-" & [MONTH] & "-" & [YEAR]

 

Result I got = Error

 

Thanks again in advance people.

Jaderson Almeida
Business Coordinator
2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: How to Add a Custom Column Date like (01-01-16, 01-02-16, etc)

I just tried this and it worked like a champ. I made sure that all of my columns were Text though so perhaps that is your issue?

 

[Day] & "-" & [Month] & "-" & [Year]

Here is the query I used:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjBU0oEQRgaGZkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Day = _t, Month = _t, Year = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each [Day] & "-" & [Month] & "-" & [Year])
in
#"Added Custom"

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


hohlick Member
Member

Re: How to Add a Custom Column Date like (01-01-16, 01-02-16, etc)

In addition to previous comment, you could use
= Text.From([DAY]) & "-" & Text.From([MONTH]) & "-" & Text.From([YEAR])
Maxim Zelensky
excel-inside.pro
4 REPLIES 4
Super User
Super User

Re: How to Add a Custom Column Date like (01-01-16, 01-02-16, etc)

I just tried this and it worked like a champ. I made sure that all of my columns were Text though so perhaps that is your issue?

 

[Day] & "-" & [Month] & "-" & [Year]

Here is the query I used:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjBU0oEQRgaGZkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Day = _t, Month = _t, Year = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each [Day] & "-" & [Month] & "-" & [Year])
in
#"Added Custom"

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


hohlick Member
Member

Re: How to Add a Custom Column Date like (01-01-16, 01-02-16, etc)

In addition to previous comment, you could use
= Text.From([DAY]) & "-" & Text.From([MONTH]) & "-" & Text.From([YEAR])
Maxim Zelensky
excel-inside.pro
bajimmy1983 Member
Member

Re: How to Add a Custom Column Date like (01-01-16, 01-02-16, etc)

Hi smoupre,

Thanks to your solution. Yep. You got it! Smiley Happy
Jaderson Almeida
Business Coordinator
bajimmy1983 Member
Member

Re: How to Add a Custom Column Date like (01-01-16, 01-02-16, etc)

Hello Hohlick,

I liked your way. Thanks a lot.
Jaderson Almeida
Business Coordinator