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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
trevorgermain
Advocate I
Advocate I

Power BI Embedded - DirectQuery dynamic parameters

I would like to be able to embed Power BI report, and be able to do a DirectQuery against my datasource based on the currently logged in user.

 

The only way I've been able to get this to work is to use the Username function in DAX, but by the time DAX is available, I'd have already had to load WAY too much data (not relevent data) into my model.

 

Can I filter at the PowerQuery?

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@trevorgermain wrote:

I would like to be able to embed Power BI report, and be able to do a DirectQuery against my datasource based on the currently logged in user.

 

The only way I've been able to get this to work is to use the Username function in DAX, but by the time DAX is available, I'd have already had to load WAY too much data (not relevent data) into my model.

 

Can I filter at the PowerQuery?


@trevorgermain

That is the only approach possible I'm aware of. As to "load too much data", you may don't worry about that. Because in DirectQuery mode, it doesn't load all data from database and then apply a filter. Instead, Power BI composes a proper SQL with the filter and send the SQL to database. Eg. in my test, I capture the below in my test with SQL Server profiler, the WHERE clause is appended due to USERNAME() filter.

Capture.PNG

View solution in original post

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee


@trevorgermain wrote:

I would like to be able to embed Power BI report, and be able to do a DirectQuery against my datasource based on the currently logged in user.

 

The only way I've been able to get this to work is to use the Username function in DAX, but by the time DAX is available, I'd have already had to load WAY too much data (not relevent data) into my model.

 

Can I filter at the PowerQuery?


@trevorgermain

That is the only approach possible I'm aware of. As to "load too much data", you may don't worry about that. Because in DirectQuery mode, it doesn't load all data from database and then apply a filter. Instead, Power BI composes a proper SQL with the filter and send the SQL to database. Eg. in my test, I capture the below in my test with SQL Server profiler, the WHERE clause is appended due to USERNAME() filter.

Capture.PNG

I've been mostly using Import mode, and have a new requirement where DirectQuery may make the most sense. Thank you for your response. I tried the exact thing you suggested and am seeing proper filtering on the query in SQL Profiler.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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