Forum Discussion
OneWithQuestion
8 years agoPost Prodigy
Pass username as filter or parameter in query using DirectQuery to SQL?
Is there anyway to pass UserName() or userPrincipalName() as a query parameter when doing direct query? For example, if I want to direct query on today's sales I can handle queries like getting t...
OneWithQuestion
8 years agoPost Prodigy
I was hoping to find a way to pass it into SQL as a parameter, I looked at using M but I didn't see any options for passing usernames that way (rather I didn't see a username function for M).
Ideally, I would be able to do a SELECT Col1, Col2, Col3 FROM Table1 WHERE Table1.Username=username()
(from PBI of course) however, I don't see anyway to pass system variables/parameters into queries.
I wanted to filter them BEFORE they are loaded, so if my table had 1 million records, I would much rather return only the records that matched UserName() instead of the entire table.
parry2k
8 years agoSuper User
Well as mentioned before, unfortunately I'm not aware of that you can pass username() value to power query, it is going to be filter after table is loaded.