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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors