Insert rows where value is zero

Hi all,

Hoping someone can assist with this. I’ve tried many different ways however could not think of a solution for this.

My dataset contains rows of data

Example:

Product Day Number of Sales
Apple 2 21
Apple 4 34
Apple 5 48
Apple 6 22
Apple 7 31
Apple 9 12

Is there any way to transform the data and insert rows containing the days where number of sales is blank (in this case day 1, day 3 and day 8) up to the max number of day (in this case day 9)?

Product Day Number of Sales
Apple 1 0
Apple 2 21
Apple 3 0
Apple 4 34
Apple 5 48
Apple 6 22
Apple 7 31
Apple 8 0
Apple 9 12

Appreciate any input or ideas

Probably not the most beautiful way, but finally it works. :slight_smile:

Community - Insert rows where value is zero.morph (4.8 KB)

2 Likes

The “Repeat rows” action should do it. Here is my version :slight_smile:

insert-empty-rows.morph (4.6 KB)

PS. @MarioBudiman special thanks for posting sample data as a table that can be copied - saved me some time.

2 Likes

Much smarter than mine. :+1:

This works like a charm. Thank you so much for this!

And thank you @Jochen_Marquardt for the alternate solution!