In Power BI’s M Language, you can use the
Date.AddDays function to add or subtract a specified number of days from a given date.
Let’s get stated-
Download the sample Dataset from below link-
Now follow these steps-
Step-1: Open Power Query Editor by selecting “Transform data” in the Home tab of Power BI Desktop.
Step-2: In the Queries pane, select the “Orders” table.
Step-3: In the Home tab, click on “Add Column” and choose “Custom Column”.
Step-4: In the “Custom Column” dialog box, provide a name for the new column, exp- “NewOrderDate”.
Step-5: In the “Custom column formula” box, enter the following expression, and click on “OK” to create the new column.
Date.AddDays([Order Date], 7)
After applying the changes, you will see a new column named “NewOrderDate” in the “Orders” table, which contains the order date plus 7 days for each row.
How to subtract 7 days from “Order date”? See the expression below:
Date.AddDays([Order Date], -7)
See the final output