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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
smpa01
Super User
Super User

Create table from list of integers by specifying true data type

++ @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

smpa01_0-1672969528704.png

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

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
2 ACCEPTED SOLUTIONS
ppm1
Solution Sage
Solution Sage

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

Microsoft Employee

View solution in original post

wdx223_Daniel
Super User
Super User

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

View solution in original post

3 REPLIES 3
wdx223_Daniel
Super User
Super User

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

ppm1
Solution Sage
Solution Sage

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

Microsoft Employee

👍

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.