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
RossBateman96
Helper I
Helper I

List.Dates function- Count error

Hi

As an example, I have a table in the below format.

PeriodstartingDateendingDate
P101/01/202428/01/2024
P229/01/202425/02/2024
P326/02/202431/03/2024

 

I want to create a table that has every date allocated to a period. I have created a custom column as per the below:

 

Table.AddColumn(#"Removed Columns", "Custom", each List.Dates([startingDate], Number.From([endingDate]-[startingDate])+1, #duration(1,0,0,0)))

 

This gives the desired output but when trying to apply these changes it comes back with the following error.

OLE DB or ODBC error: [Expression.Error] The 'count' argument is out of range..

 

I can't work out why this is, does anyone else know?

 

Thanks in advance,

Ross

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@RossBateman96 , try using below mentioned code

 

Table.AddColumn(#"Removed Columns", "Custom", each if Number.From([endingDate] - [startingDate]) >= 0 then List.Dates([startingDate], Number.From([endingDate] - [startingDate]) + 1, #duration(1,0,0,0)) else null)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@RossBateman96 , try using below mentioned code

 

Table.AddColumn(#"Removed Columns", "Custom", each if Number.From([endingDate] - [startingDate]) >= 0 then List.Dates([startingDate], Number.From([endingDate] - [startingDate]) + 1, #duration(1,0,0,0)) else null)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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.