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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors