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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
LuisQuedas
Advocate I
Advocate I

How to use the same oData Feeds with different user name and password?

Hi All,

 

I've an oData Feed that returns different data according the user name and Password, (it never returns All data, a business rule), ie., if I connect the URL for the data Feed using the User1, it returns information of Dept1, if I connect URL for the data Feed using the User2, it returns information of Dept2. So, I would like to do the two queries and merge them inside Power BI Desktop.

 

it seems that I can't do that using Power BI Desktop latest release, Am I right? or I'm missing something.

 

Many Thanks, Luis

3 REPLIES 3
ImkeF
Super User
Super User

Not sure if I understood your request correctly, but you could do the following:

Create a table where the first column contains the Username and the second the password. Then add a column that performns the call. In there, use the references to your first 2 columns like this:

 

myUrlpart..UsernameFollowing:"&[Column1]&"....PasswordFollowing:"&[Column2]&"

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi Imke, thanks for your reply.

 

let me try to be more clear,

 

I've a oData Feed URL:  https://myServer/MyAPI, it uses basic authentication, the data retrieved depends on the user/password I use to connect the Feed.

As an example, imagine I've a user1, when I use it to connect the oData Feed,  the data table retreived only data from Department 1, the department that user1 belongs to. Then I've a second user,  user2, when I use it to connect the oData Feed,  the data table retreived only data from Department 2, the department that user2 belongs to.

Finnaly I want to merge the two data tables inside Power BI.

 

I.e. , I need to get data twice from the same https://myServer/MyAPI, but using different User/Password. (i.e., add two oData feeds  to my Power BI file, using the same URL, but different user and password)

 

Hope I made it more clear now.

 

Many Thanks, Luis

Hi Luis,

So you have the Username and the Password as part of you URL, like this i.e.?:

 

"https://myServer/MyAPI/MyUsername/MyPassword"

 

Then you have to write your modified URL-string in your added column like this:

 

 

"https://myServer/MyAPI/"&[Column1]&"/"&[Column2]&""

 

So you replace the strings with the username and password by a reference to your columns.

 

Please have a look at this example, where a similar thing is done for a paginated URL, where the page numbers are the variables. In your case you 2 columns are your variables/parameters:

 

http://community.powerbi.com/t5/Desktop/how-to-create-a-query-that-paginates/m-p/95843#M40384

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.