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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Capturing latest table name and used in powerbi native query

Details –

Need to extract all tables from the schema

Identify the latest table based on date attached at end of the table name

Extract the data from POWRBI using the latest table

 

tables available as below in schema.

hanurao_0-1625837998635.png

Steps performed below to achieve the results, but I’m unable to capture the tablename in parameter to utilize in Query2 PowerBI. Any help is appriciated 

Query1 – Query used to pick the latest table then converted to list

Parameter – Used to capture value from the Query1

Query2 – used to get all records from the latest table name passed from parameter.

 

Query1- Created this to identify the latest table name, then Converted this Query1 to list

hanurao_2-1625838116780.png

Parameter – Used capture the result from Query1 using query option, screenshot below.

hanurao_4-1625838193378.png

 

Query2 – Used to get all records from the latest table name, passed parameter as highlited below.

hanurao_6-1625838236686.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I would make a new query named LatestTable, and in the formula bar, type:

= List.Max(Table_Name)

 

Then, in the advanced editor, make it so that your SQL is like:

Query = "SELECT TheFirstPart.OfYourTable_"&LatestTable&" as tablename from all_tables where owner = 'What_Ever' and table_name like 'Something'"])

 

--Nate

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

That's controlled in the program options, under security, I think. 

Anonymous
Not applicable

I would make a new query named LatestTable, and in the formula bar, type:

= List.Max(Table_Name)

 

Then, in the advanced editor, make it so that your SQL is like:

Query = "SELECT TheFirstPart.OfYourTable_"&LatestTable&" as tablename from all_tables where owner = 'What_Ever' and table_name like 'Something'"])

 

--Nate

Anonymous
Not applicable

thank you so much and it's working as expected. But i would like to know when we schedulle this report in service daily, the below popup will taken care by automatically or not. Beacuser every day our query is the new one..

hanurao_0-1625985992553.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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