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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Add a column of date to a column of numbers in a new column

Hello everyone , 

I want to add a column of  dates to a column of numbers in a new column . Thanks ! 

2 ACCEPTED SOLUTIONS

add custom column with this formula
Date.AddDays([column1],[column2])

 

View solution in original post

PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download example PBIX file

 

In Power Query add a Custom Column with this code

 

 

= Date.AddDays([Date] , [Number])

 

 

 

Here's the full example query

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU30zcyMDJW0lEyVYrViVYystA3homYKMXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Number = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Number", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "New Date", each Date.AddDays([Date] , [Number]))
in
    #"Added Custom"

 

 

 

adddays.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

9 REPLIES 9
PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download example PBIX file

 

In Power Query add a Custom Column with this code

 

 

= Date.AddDays([Date] , [Number])

 

 

 

Here's the full example query

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU30zcyMDJW0lEyVYrViVYystA3homYKMXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Number = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Number", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "New Date", each Date.AddDays([Date] , [Number]))
in
    #"Added Custom"

 

 

 

adddays.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

Hi theracy , I have a date column ( dd/mm/yyyy) and i have a numbers columns , i want a new column where it represents the sum of the two columns . For example , i have in date table ( 05/06/2023) and in the numbers column 5 then the result in the column that i want will be 10/06/2023 . if the date is 28/03/2023 and in number column we have 4 then the result will be 01/04/2023 . Thanks 

add custom column with this formula
Date.AddDays([column1],[column2])

 

Anonymous
Not applicable

Hey @aditya0125 , 

You can see in the picture below the result that i wanted ! Thanks cap.png

see this result bro.Screenshot (44).png

Anonymous
Not applicable

@aditya0125 It add on the month not the days , Thanks !

Bro its MM/DD/YYYY. so it add date not month.

aditya0125
Resolver I
Resolver I

not getting it bro. be more specified.

 

PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Please be a lot more specific about what it is you are trying to do, provide some sampe data, and give an example of the desired result.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.