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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
MSMK
New Member

Add Column Comparing Two Date Columns and Returning the Next date in Column 2 from Column 1

I am customizing my date table for my business. I have built a column containing only the dates we are open. As we are closed on the weekend I have null values for Saturday, Sunday and holiday closures.

 

I need a third column added to my date table containing the current business day if open or if closed, the next day we're open.

 

I have tried Table.Min with little success. I have tried MINX with filters for open_date<> null and open_date>=Date.Date. I keep getting circular reference errors.

 

This is the result I'm looking for. Thank for looking.

 

Date.Datedate_openResult
12/31/202612/31/202612/31/2026
12/30/202612/30/202612/30/2026
12/29/202612/29/202612/29/2026
12/28/202612/28/202612/28/2026
12/27/2026 12/28/2026
12/26/2026 12/28/2026
12/25/202612/25/202612/25/2026
12/24/202612/24/202612/24/2026
12/23/202612/23/202612/23/2026
12/22/202612/22/202612/22/2026
12/21/202612/21/202612/21/2026
12/20/2026 12/21/2026
12/19/2026 12/21/2026
12/18/202612/18/202612/18/2026
12/17/202612/17/202612/17/2026
12/16/202612/16/202612/16/2026
12/15/202612/15/202612/15/2026
12/14/202612/14/202612/14/2026
12/13/2026 12/14/2026
12/12/2026 12/14/2026
1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

You may be able to add the column referencing the [date_open] column and then doing a Table.FillUp() (or Table.FillDown() depending on which way the table is sorted) step to the new column.





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

Proud to be a Super User!





View solution in original post

4 REPLIES 4
MSMK
New Member

Thanks very much. That worked a treat.

MSMK
New Member

Thank you for looking.

 

Table.AddColumn(#"Removed other columns", "result", each Table.FillDown(table name, [date_open]))
 
Result was an error:
Expression.Error: A cyclic reference was encountered during evaluation. 
 
That's the error I've seen a lot so I must be doing something fundamentally off. The table I'm using is the name of the table.

Try doing it in two steps.
Add a column that is just [date_open] and then in the next step fill down that column.





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

Proud to be a Super User!





jgeddes
Super User
Super User

You may be able to add the column referencing the [date_open] column and then doing a Table.FillUp() (or Table.FillDown() depending on which way the table is sorted) step to the new column.





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

Proud to be a Super User!





Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.