Duplicate manager values in Power BI

When duplicate user accounts exist in of LMS365 (Learn365), Power BI may throw this error mentioning the duplicate value and the login name associated with them. This error is most likely caused by the user being deleted from Active Directory and then having the same account recreated again. If this error keeps occurring, we recommend working with your Active Directory team and having them disable users for a specific time period before deleting the account.




To allow Power BI to run the report, you can either change the Power BI table relationships or merge the two accounts together.

Going the Power BI route means that you only have to do this process once. However, if there is a situation where the duplicate accounts are truly two different people, then the Power BI report would refer the manager/subordinate relationship to both of these two different people. 

The benefit of merging users via the API is that their enrollment history is properly transferred to the correct LMS365 (Learn365) account. The downside to this process is that it takes a few more steps and may need to be done multiple times (if the Active Directory processes keep removing and re-adding users). 

Both of these processes are described below.


Solution 1: Changing Table Relationships in Power BI

1. To change the Table Relationships in Power BI so that this error never occurs, go to the Data view on the left-hand side of the screen.



2. Click on "Manage relationships" at the top menu.



3. In the pop-up window, select the Users to Managers relationship and then click Edit:




4. Change the Cardinality to "Many to many" and click OK.




Solution 2: Merging Users accounts

In order to merge the users accounts together, we need to utilize the API key to find the User's IDs and to run the merge command. 

1. Go to api.365.systems.

2. Authorize your browser by clicking on the Authorize button.




Under Basic authorization enter "api" as the username and the API Key as the password.




3. Once authorized, click Close or the "X" at the top right corner.




4. Scroll down to the Users section to find the GET /odata/v2/Users command.




5. Expand the tab and click on the Try it Out button at the top right corner.




6. Click on the Execute option down at the bottom.





If you are asked for a username and password, please enter "api" as the username and your organization's API key as the password. Directions for how to get the API Key can be found in the API keys management article.


7. After running the command, you are able to scroll down and Download the output at the bottom right corner. After downloading the file, you can open it with notepad and search the users email using the Control + F keys.



8. The following image shows an example of duplicate accounts. They both have the same email, but have different Object Ids. Notice that the account that is at the top has an "IsDeleted" status of True.


9. After grabbing all of the information for both accounts, head back to the API page (step 4) and find the POST /odata/v2/Users('{LoginName}')/Merge command. We will enter this command and click on the Try It Out button.



10. For this command, we need to fill out the top option with the Directory Object ID of the Account that you would like to keep. The bottom option will be filled out with the Directory Object ID of the Account to be removed.





To determine which account to keep and remove, we recommend to look at the "IsDeleted" field. In almost every case, the account that is removed has the "IsDeleted" field as True.


11. Once filled out, click on the Execute button to run the command. The two accounts will then be merged. To verify that this merge was successful, return to steps 3 through 5 to rerun the command and then download all of the users and verify that the duplicate account has been removed (we recommend waiting a few minutes for verification to allow the changes to go through).

12. After all of these steps have been run, you should now be able to refresh your PowerBI report with no errors!

You should now be able to refresh the report and have it run successfully without that error. For more information on Many-to-Many relationships, please visit: Many-to-many relationships in Power BI Desktop - Power BI | Microsoft Docs.


Was this article helpful?
14 out of 14 found this helpful


Article is closed for comments.