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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
akdoro
New Member

M Query : Create a table using input from another table

I have this table, let us call it 'tblSeasons'

 

 StartDate   EndDate   Season

02-05-20165-05-2016Round 0
11-05-201615-08-2016Round 1
21-08-201615-11-2016Round 2
16-11-201609-01-2017Round 3
10-01-201715-02-2017Round 4
01-04-201720-05-2017Round 0

 

 

I want to generate another table 'SeasonDetails' with continuous dates using the above table as the input parameter :

 

That is:

 

DateRound
02-05-2016Round 0
03-05-2016Round 0
04-05-2016Round 0
05-05-2016Round 0
11-05-2016Round 1
12-05-2016Round 1
13-05-2016Round 1
14-05-2016Round 1
15-05-2016Round 1

 

 

etc..

 

How do I go about this?

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

here you will find a little example (open the query editor).

 

Basically I added a custom column using this formula

List.Dates(
  [DateStart],
  Number.From([DateEnd]) - Number.From([DateStart]) + 1,
  #duration(1,0,0,0)
)

You have to make sure that your columns are date columns and have valid entries. My Formula does not consider any Data Quality check or similar stuff 🙂 The Formula creates a list.

 

The next step is: expand the list as new rows:

2017-07-11_22-24-20.png

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

here you will find a little example (open the query editor).

 

Basically I added a custom column using this formula

List.Dates(
  [DateStart],
  Number.From([DateEnd]) - Number.From([DateStart]) + 1,
  #duration(1,0,0,0)
)

You have to make sure that your columns are date columns and have valid entries. My Formula does not consider any Data Quality check or similar stuff 🙂 The Formula creates a list.

 

The next step is: expand the list as new rows:

2017-07-11_22-24-20.png

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

@TomMartens ThankYou! That works!

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.