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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jPinhao
Helper II
Helper II

Dynamically generate query tables

I'm importing data from an Azure Blob, and then generating some queries to share on the online portal. One of my intermediate queries generates a table of [name][table] like:

 

Query: ALL TABLES
name  | table 
-------------------
name1 | Table1
name2 | Table2
name3 | Table3

 

The names are unique (grouped by name in previous query step), and the table links all point to a table I want to use in a new query. Currently I'm having to manually generate new queries from each Table, and then apply a custom query function on the query source to get the desired final query to export, eg.:

 

Query: NAME1
let
    Source = #"ALL TABLES",
    #"Name1" = DoSomething(Source, 0)
in
    #"Name1"

Query: NAME2
let
    Source = #"ALL TABLES",
    #"Name2" = DoSomething(Source, 1)
in
    #"Name2"

etc.

 

This is ok for now as we're setting up, we don't have that many entries. However as soon as we start putting real data into the Azure Blob the number of rows and queries we need to generate will start growing, and doing it by hand is un-manageable.

Ideally I'd be able to add a last step to the ALL TABLES query, that goes through all the rows and generates new queries from the tables in them. This list will also potentially change with each update, so ideally this should automatically generate the new queries when the data is reloaded form the Azure Blob.

 

Is there a way to do this from a Power BI query? Alternatively, does anyone know where I might look on how to make an external script generate this on a power BI project (say, an automated script run daily from our build server)?

13 REPLIES 13

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.