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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
rpiboy_1
Helper V
Helper V

Generate new Queries from Function

This is entirely a theoretical question at the moment, and perhaps it will solve itself as I continue development. Mostly interested to see what people have to say or what their thoughts are.

 

At present I have two queries (highlighted in yellow) that I built 'manually'. I was then able to write a function (red) that is capable of generating both Yellow Queries based on inputing different arguements. The data to generate the result (Green/boxed red) comes from two other queries (Purple/Teal).

queries.png

I know that if I had a table with the neccessary arguement values as columns I could call the function as 'Add Column' and it would generate a column that contains Table(s) as the result of the function call per row. So a result like this:

 

IDArguement1Arguement2etc.NewColumn(function result)
1value1value2<>Table
2valueAvalueB<>Table

 

The question then, is there a way to dynamically through PQ to break the Table Results in the new column out as unique, seperate queries, which could then be loaded as seperate Tables? Like my original Queries highlighted in Yellow?

2 REPLIES 2
rpiboy_1
Helper V
Helper V

This is entirely a theoretical question at the moment, and perhaps it will solve itself as I continue development. Mostly interested to see what people have to say or what their thoughts are.

 

At present I have two queries (highlighted in yellow) that I built 'manually'. I was then able to write a function (red) that is capable of generating both Yellow Queries based on inputing different arguements. The data to generate the result (Green/boxed red) comes from two other queries (Purple/Teal).

queries.png

I know that if I had a table with the neccessary arguement values as columns I could call the function as 'Add Column' and it would generate a column that contains Table(s) as the result of the function call per row. So a result like this:

 

IDArguement1Arguement2etc.NewColumn(function result)
1value1value2<>Table
2valueAvalueB<>Table

 

The question then, is there a way to dynamically through PQ to break the Table Results in the new column out as unique, seperate queries, which could then be loaded as seperate Tables? Like my original Queries highlighted in Yellow?

v-yalanwu-msft
Community Support
Community Support

Hi, @rpiboy_1 ;
Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn
Based on my understanding, you can try using dynamic parameters. This is a more consistent approach.
If not, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

Solved: How to upload PBI in Community - Microsoft Power BI Community


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.