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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
daanp
Frequent Visitor

How to create rows based on dates on seperate rows?

Hi all,

 

I'm trying to create an inventory table. 

 

Currently i have this:

user          date          Key

John1/2/20165
Jane3/2/20165
John6/2/20165
Mike8/2/20165

 

 

What i need is this:

user         date           Key

John1/2/20165
John2/2/20165
Jane3/2/20165
Jane4/2/20165
Jane5/2/20165
John6/2/20165
John7/2/20165
Mike8/2/20165

 

so i need to add rows with the missing dates and fill down the Users and Key. 

 

any advice on how i can accomplish this with power query?

3 REPLIES 3
TomMartens
Super User
Super User

Hey,

 

the little secret is M function List.Dates() ...

Here you will find a little pbix file

In the Query Editor I added a custom column using this function

List.Dates([Date],[Index], #duration(1,0,0,0))

After expanding the column to new rows you will receive what you are looking for

List.Dates.png

 

Hope this gets you started

 

Regards

 



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
MarcelBeug
Community Champion
Community Champion

It requires some coding (steps Custom1 and Custom2 below).

 

Transform the dates to numbers, and make a list from the minimum value to the maximum value.

Turn this into a table.

Now you can use standard menu-options:

Transform numbers back to dates.

Merge with the original table and fill down the missing values.

 

let
    Source = Table1,
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", Int64.Type}}),
    Custom1 = {List.Min(#"Changed Type"[Date])..List.Max(#"Changed Type"[Date])},
    Custom2 = Table.FromColumns({Custom1},{"date"}),
    #"Changed Type1" = Table.TransformColumnTypes(Custom2,{{"date", type date}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type1",{"date"},Table1,{"Date"},"Table1",JoinKind.LeftOuter),
    #"Expanded Table1" = Table.ExpandTableColumn(#"Merged Queries", "Table1", {"user", "Key"}, {"user", "Key"}),
    #"Filled Down" = Table.FillDown(#"Expanded Table1",{"user", "Key"})
in
    #"Filled Down"

 

Specializing in Power Query Formula Language (M)

Hi Marcel,

 

Thanks for your quick reply.

 

Your solution works for the dataset i provided.

 

However, i forgot to mention something. The dataset contains different keys with the same dates:

 

Jane3-2-20165
John6-2-20165
Mike8-2-20165
John1-2-20166
Jane3-2-20166
Mike8-2-20166

 

and i need:

 

   
Jane3-2-20165
Jane4-2-20165
Jane5-2-20165
John6-2-20165
John7-2-20165
Mike8-2-20165
John1-2-20166
John2-2-20166
Jane3-2-20166
Jane4-2-20166
Jane5-2-20166
Jane6-2-20166
Jane7-2-20166
Mike8-2-20166

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors