Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

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

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

  • v-yingjl's avatar
    v-yingjl
    Community Support

    Hi Anonymous ,

    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.