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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lauravd
Frequent Visitor

Expanding List.Numbers - wrong results

Hi, 

 

I am trying to get a list of dates reoccuring every 21 day from start date. Duration of first event is 442days/21days between events =21 times event should happen. By expanding my list I should get 21 row with same event_ref number, but it changes all event_ref numbers. 

 

I've got a table as per picture below:
List.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

My Custom Column is created using this fuction:


1.JPG

 

 

 

 

 

 

 

 

 

 

 

 

Once I expand my list as new rows it changes event references.
result.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Any Ideas? 

 

Thank you.

 

 

1 ACCEPTED SOLUTION

Is this what your expecting?

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ1NgFiJR0lEyMLA0sQbWxkagikjQyVYnWACszMzYEiYAkDmAJzUxQFZpZQCQNTCG1oCTMhFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, start_date = _t, end_date = _t, Intervals = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"start_date", Int64.Type}, {"end_date", Int64.Type}, {"Intervals", Int64.Type}}),
    #"Added Custom3" = Table.AddColumn(#"Changed Type", "Duration", each ([end_date]-[start_date])),
    #"Added Custom1" = Table.AddColumn(#"Added Custom3", "Custom.1", each List.Numbers([start_date],[Duration]/21,21)),
    #"Expanded Custom.1" = Table.ExpandListColumn(#"Added Custom1", "Custom.1")
in
    #"Expanded Custom.1"

View solution in original post

5 REPLIES 5
stretcharm
Memorable Member
Memorable Member

Your syntax is wrong

 

List.Numbers(start as number, count as number, optional increment as nullable number) as { Number }

 

The 2nd param is count (not end) so if you want 21 rows it should be  21 or the Duration/21

Hi, 21 is just an example number as other events (check event ref) have different duration so occurrence as will be different ( not 21 rows for each event). Any more ideas?:)

Thanks.

Is this what your expecting?

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ1NgFiJR0lEyMLA0sQbWxkagikjQyVYnWACszMzYEiYAkDmAJzUxQFZpZQCQNTCG1oCTMhFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, start_date = _t, end_date = _t, Intervals = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"start_date", Int64.Type}, {"end_date", Int64.Type}, {"Intervals", Int64.Type}}),
    #"Added Custom3" = Table.AddColumn(#"Changed Type", "Duration", each ([end_date]-[start_date])),
    #"Added Custom1" = Table.AddColumn(#"Added Custom3", "Custom.1", each List.Numbers([start_date],[Duration]/21,21)),
    #"Expanded Custom.1" = Table.ExpandListColumn(#"Added Custom1", "Custom.1")
in
    #"Expanded Custom.1"

Thank you once again. Got it all sorted.

Hi, 

 

Yes, this is what I am expecting. Thank you.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.