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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Custom Column with addition of # of Days from Another Column

Sorry if this was asked previously I couldn't find it.  My end goal is to display the date we will run out of a material.  I basically have a column that contains today date and another column with a # of Days we have on hand.  Currently getting error expression.error The number is out of range of a 32 bit interger value.

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

Hi, @Anonymous ;

You could add custom column such as:

Date.AddDays([Date],[days])

vyalanwumsft_0-1663136214583.png

Or 

[Date]+#duration([days],0,0,0)

vyalanwumsft_1-1663136342800.png

The final show:

vyalanwumsft_2-1663136363691.png

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


Best Regards,
Community Support Team _ Yalan Wu
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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could add custom column such as:

Date.AddDays([Date],[days])

vyalanwumsft_0-1663136214583.png

Or 

[Date]+#duration([days],0,0,0)

vyalanwumsft_1-1663136342800.png

The final show:

vyalanwumsft_2-1663136363691.png

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


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HotChilli
Super User
Super User

I understand in basic terms what you are trying to do. Add a number of days (in a column) to a date from another column.  That's why I showed the function AddDays. 

If there is a problem with "# of days" being null or zero then show me what you have and what you want the desired result to be

Anonymous
Not applicable

Sorry I am very new user.  I tried that but the # isn't consistant.  I actually want the date column (9/13/2022) to get added to a column that has the # of days (for example, 3)  I want it to display 9/16/2022 but not every row will have contact number (like 3)

HotChilli
Super User
Super User

Are you using the Date.AddDays function?

e.g. Date.AddDays(#date(2011, 5, 14), 5)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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