The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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"
Solved! Go to Solution.
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
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