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
EricHulshof
Solution Sage
Solution Sage

How to add x weeks to a calculated column?

Hi everyone,

 

I have a date type field. and would like to add an amount of weeks to that, in a calculated column.

 

Example data:

 

CodeDate
101/10/2019
101/10/2019
201/10/2019
301/10/2019

 

Desired outcome:

CodeDateDeadline:
101/10/201915/10/2019
101/10/201915/10/2019
201/10/201922/10/2019
301/10/201929/10/2019

So if code = 1 i want to add 2 weeks. when 2, 3 weeks and when 3 i'd like to add 4 weeks.

 

I tried using DATEADD()

but i could not get that to work. Anyone got a solution?

 

Thankyou!


Quality over Quantity


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


1 ACCEPTED SOLUTION
Anonymous
Not applicable

Good day budd,

One of the things that you can do to help you get what you looking for is to create a custom column in the Query Editor and with a simple code magic will happen 🙂

2019-10-01 13_08_12-Untitled - Power Query Editor.png

Code:

= Table.AddColumn(#"Removed Columns", "DeadLine",
each if [Code] = 1 then Date.AddDays([Date],14) else if [Code] = 2 then Date.AddDays([Date],21) else if [Code] = 3 then Date.AddDays([Date],28) else null)

Best of luck 😉

 

Hicham 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Good day budd,

One of the things that you can do to help you get what you looking for is to create a custom column in the Query Editor and with a simple code magic will happen 🙂

2019-10-01 13_08_12-Untitled - Power Query Editor.png

Code:

= Table.AddColumn(#"Removed Columns", "DeadLine",
each if [Code] = 1 then Date.AddDays([Date],14) else if [Code] = 2 then Date.AddDays([Date],21) else if [Code] = 3 then Date.AddDays([Date],28) else null)

Best of luck 😉

 

Hicham 

 

Thanks!

 

I was constantly searching for things with weeks. But days could ofcourse work just as fine!


Quality over Quantity


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


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.