cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
viji123
Frequent Visitor

How to pass Current logged in userId to Web API call

Hi,

 

My datasource is a web API.It requires a userid to be passed as a query paramater string.How can i pass the userid of the currently logged-in user to the powerquery code that calls the API?I can see the currently logged in user's name from Username()  DAX function,However I cannot pass this value to powerquery.This is my code snippet.I need to capture the currently logged in user and pass it to EnterpriseId

viji123_0-1638167565578.png

Also, currently , my storage mode is import.Is it possible to change to DirectQuery when source is web API

Appreciate any help.TIA

 

 

1 REPLY 1
v-yingjl
Community Support
Community Support

Hi @viji123 ,

If you want to get the username like using DAX Username() in Power Query, you can refer these articles which introduces some ways to achieve this:

  1. 4 ways to get USERNAME in Power Query 
  2. Get username function in Power Query 

 

In addition, when using Web API, it is not supported to use Direct Query mode in Power BI.

 

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

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors