cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
DanAspire42
Regular Visitor

Dynamically Generated Queries

Hi all,

 

I have a master list with a column of staff members names.

DanAspire42_0-1695887717860.png

 

I need a query per staff member (to load to a table/sheet in excel)

 

Currently I have manually referenced the master query then filtered staff member column to a given name.

DanAspire42_1-1695887803670.png

 

These names on this list change at any time, is there a way to have a referenced query automatically generated for each unique staff memebr name automatically and filtered to that name when the names on the master query change?

Any help appreciated.

1 ACCEPTED SOLUTION

In general you cannot have Power Query queries created on the fly, so I would say no. But I have no experience with Excel - maybe you can fudge something through Office scripts.

View solution in original post

6 REPLIES 6
DanAspire42
Regular Visitor

Hi @lbendlin 

Pulling data from a database, we have a ledger of clients where each is assigned to a staff member given some variables. Management will occasionally add/remove staff members assigned to these clients.

I have to build a workbook that has a worksheet for each staff member who currently has some clients assigned.

Currently I am referencing the main query with the complete list of clients and respective staff, then filitering staff asigned column to a given staff members name manually, rinse and repeat for ~20 staff members.

Is there a way for excel to automatically generate a new query when a new staff member is added to this list and hence automatically load a new worksheet with the table for that new staff member.

Haven't been too sure how to describe this process simply for google.

Unfortunately unable to make any changes to databse structure has to be all completed with Excel.

Regards

how is that new staff member assigned to clients?

Comes from database, is just a column of staff names, with each row being a client and then their respective staff member in the column

In general you cannot have Power Query queries created on the fly, so I would say no. But I have no experience with Excel - maybe you can fudge something through Office scripts.

Hi @lbendlin ,

Thanks for your help, I read this was the case in an older post was hoping that might have changed. Have achieved what I needed via VBA to create new worksheets.

lbendlin
Super User
Super User

Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors