Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
++ @AlexisOlson @CNENFRNL @Rickmaurinus
Referring to this
Is there a way to create a table from a list of integers in one shot?
E.g.
If I do this,
let
yearMax = 2023,
yearMin=yearMax-1,
yearList = {yearMin..yearMax},
tbl = Table.FromList(
yearList,
null,
type table[ actualYr = Int64.Type ]
)
in
tbl
I run into this
I know I can do this. But I want to avoid any extra step if I can, given that PQ is doing heavy transformations in succeeding steps and I want to optimize as much as I can.
let
yearMax = 2023,
yearMin=yearMax-1,
yearList = List.Transform({yearMin..yearMax},each Text.From(_)),
tbl = Table.FromList(
yearList,
null,
type table[ actualYr = Text.Type ]
),
#"Changed Type" = Table.TransformColumnTypes(tbl,{{"actualYr", Int64.Type}})
in
#"Changed Type"
Thank you in advance
Solved! Go to Solution.
Please try this instead.
let
yearMax = 2023,
yearMin=yearMax-1,
yearList = {yearMin..yearMax},
tbl = #table( type table [actualYr = Int64.Type], List.Split(yearList, 1))
in
tbl
Pat
this code works
let
yearMax = 2023,
yearMin=yearMax-1,
yearList = {yearMin..yearMax},
tbl = Table.FromList(
yearList,
Splitter.SplitByNothing(),
type table[ actualYr = Int64.Type ]
)
in
tbl
this code works
let
yearMax = 2023,
yearMin=yearMax-1,
yearList = {yearMin..yearMax},
tbl = Table.FromList(
yearList,
Splitter.SplitByNothing(),
type table[ actualYr = Int64.Type ]
)
in
tbl
Please try this instead.
let
yearMax = 2023,
yearMin=yearMax-1,
yearList = {yearMin..yearMax},
tbl = #table( type table [actualYr = Int64.Type], List.Split(yearList, 1))
in
tbl
Pat
👍