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! Request now

Reply
Nyx
Frequent Visitor

List generation from minimum value and maximum value of multiple columns of a table.

Attempting to generate a list of values when the upper and lower limits are determined by the min and max values from any cell of multiple columns. Currently produces Error in 1 cell under "List".

 

 

let
Source = List.Generate(() => List.Min({Column[1],Column[2],Column[3]},0), each _ <= List.Max({Column[1],Column[2],Column[3]}), each _ + 1)
in
#"Source"

1 ACCEPTED SOLUTION
jbwtp
Memorable Member
Memorable Member

Hi @Nyx,

 

You are getting htis error because the code tries to find min/max between the lists (not the numbers), kind of List.Min({List1, List2, List3}). PQ just does not know how to compare them (and after all this is not what you want anyway). You can fix it by combining all the lists into a single one using List.Combine:

let

    Column = 
        let
            Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIGYjOlWJ1oJSMgywSIzcE8kLgpEFuAeSZgVTpKlkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"1" = _t, #"2" = _t, #"3" = _t]),
            #"Changed Type" = Table.TransformColumnTypes(Source,{{"1", Int64.Type}, {"2", Int64.Type}, {"3", Int64.Type}})
        in
            #"Changed Type",

    Source = List.Generate(() => List.Min(List.Combine({Column[1],Column[2],Column[3]}) & {0}), each _ <= List.Max(List.Combine({Column[1],Column[2],Column[3]})), each _ + 1)
in
    #"Source"

Cheers,

John

 

View solution in original post

1 REPLY 1
jbwtp
Memorable Member
Memorable Member

Hi @Nyx,

 

You are getting htis error because the code tries to find min/max between the lists (not the numbers), kind of List.Min({List1, List2, List3}). PQ just does not know how to compare them (and after all this is not what you want anyway). You can fix it by combining all the lists into a single one using List.Combine:

let

    Column = 
        let
            Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIGYjOlWJ1oJSMgywSIzcE8kLgpEFuAeSZgVTpKlkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"1" = _t, #"2" = _t, #"3" = _t]),
            #"Changed Type" = Table.TransformColumnTypes(Source,{{"1", Int64.Type}, {"2", Int64.Type}, {"3", Int64.Type}})
        in
            #"Changed Type",

    Source = List.Generate(() => List.Min(List.Combine({Column[1],Column[2],Column[3]}) & {0}), each _ <= List.Max(List.Combine({Column[1],Column[2],Column[3]})), each _ + 1)
in
    #"Source"

Cheers,

John

 

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.