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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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

Power BI Monthly Update - September 2025

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