top of page

How to map a Lookup Column in a Power Platform Dataflow

Writer's picture: Hamish SheildHamish Sheild

Updated: Jun 5, 2022

Power Platform dataflow provides an effortless way to unify data from disparate sources and prepare it for use inside Dataverse.


If you know what you are doing.


In the past I have battled with getting a dataflow to relate records together i.e., setting a lookup column on one record to relate it to another.


I’ve also struggled to find complete documentation on this topic, but there is one key tip that makes this all possible. It is all about alternate keys!


This article uses a common scenario to walk you through step by step, how to map a Dataverse lookup column in a Power Platform dataflow.


Read on to find out more. 👇


The Scenario


I had a requirement to load product information from an ERP system into Dataverse so that it can be used with the Dynamics 365 Sales app. To be able to create a Product record in Dynamics 365 you must relate the Product to a Unit and Unit Group.


r Product, Unit and Unit Group entities in Dynamics 365
Relationship diagram for Product, Unit and Unit Group tables in Dynamics 365

The Unit and Unit Group lookup columns on the Product table have the following definition in the Power Apps maker portal. It is a good idea to note the names of these columns for later.


Unit and Unit Group columns on the Product table in Dataverse (Dynamics 365 Sales)
Unit and Unit Group columns on the Product table in Dataverse (Dynamics 365 Sales)

For simplicity, I am going to demonstrate this scenario using Excel as the data source (as opposed to an ERP system). The sample data links the Product to the Unit and Unit Group by their respective names. However, instead of using the name column, this could be a unique id value for the Unit and Unit Group instead (recommended).


Sample product data for use with Power Platform dataflow
Sample product data for use with dataflow

Why is mapping a Dataverse lookup Column in dataflows difficult?


Before I give the solution, I think it is important to discuss why it can be difficult and where a lot of people get stuck.


If you have not set any alternate keys, then at the column mapping stage of creating a dataflow, you will run into issues.

  1. There are no Key columns available to select – the key column is used by the dataflow to decide whether to add a new row to the table or update an existing one. If you don’t set the Key column, then you will end up with duplicate rows in Dataverse if you run the dataflow multiple times e.g., if you are configuring your dataflow to auto-refresh on a schedule.

  2. The Unit and Unit Group lookup columns are not available in the mapping list.

Both of these issues are due to not having alternate keys defined on any of the tables in Dataverse.

Missing key column and lookup columns in dataflow mapping
Missing key column and lookup columns in dataflow mapping

How to map Dataverse lookup Columns in dataflows


The solution is really quite simple, once you know what to do.


Create alternate keys on the Product, Unit and Unit Group tables. For this post I am going to keep things very simple and create keys for out-of-the-box columns on these tables. You can create the alternate key for which ever column you want – as long as you know that the column value for each row is always going to be unique.


Note: I recommend not creating a alternate key on the Name column in a production setting, like I am doing for Unit and Unit Group in this example.

Configure the Product alternate key
Configure the Product alternate key

Configure the Unit alternate key
Configure the Unit alternate key

Configure the Unit Group alternate key
Configure the Unit Group alternate key


Mapping the dataflow lookups


Now that the alternate keys are configured, we can have another go at the dataflow lookup mapping. On the column mapping screen of the dataflow we are now able to set the alternate key column and the Unit and Unit Group lookup columns are available to map.

Successful mapping configuration of Dataverse lookup columns in dataflow
Successful mapping configuration of Dataverse lookup columns in dataflow

Notice the names of the Unit and Unit Group mapping columns. They have the format of lookup column name (from Product) + “.” + the related table's key name e.g., the Unit lookup column mapping name is DefaultUoMId.Name.


Once the dataflow configuration is complete and the dataflow runs, the Product records are created in Dataverse correctly with the Unit and Unit Group lookup columns set.


Product data in Dynamics 365 (Dataverse) after dataflow run
Product data in Dynamics 365 (Dataverse) after dataflow run


Power Platform Dataflow to Dataverse Lookups Conclusion


For more information on dataflows and alternate keys, refer to the following Microsoft docs.


I hope this post helps fill a gap in some of the documentation around dataflows and setting lookup columns. Remember, they key is alternate keys!


Note: this post is a re-write of the post titled How to map a Lookup field in a Power Platform Dataflow, April 2020, from my Dynamics Citizen Developer site which is no longer active. Due to multiple requests to be able to see this post I have added it to this site. Glad to see this information is still relevant and helping others!

16 comments

16 comentários


Convidado:
07 de jan.

Hello Hamish, Just want to say that this post helped me to solve my import issue. Thank you for your help. It is much appreciated!

Curtir

Convidado:
24 de nov. de 2024

For Kiwi players, Bizzo Casino NZ offers an impressive range of pokies, table games, and live casino options that are sure to cater to all tastes. The casino is known for its secure gaming environment, fast payouts, and excellent mobile support, allowing players to enjoy their favorite games wherever they are. Regular promotions and a straightforward user interface further enhance the experience, making it a standout platform for New Zealand’s online gaming community at bizzocasino.

Curtir

Convidado:
10 de mai. de 2024

What if my lookup table is 'Microsoft Entra ID'? I have a Lookup column User to that table, which already has an ID (aaduserId) in the form of a GUID but no Key. Due to this is a system table, I can't create a new key on this... What would be the solution to that?

Curtir
Jack
30 de nov. de 2024
Respondendo a
What if my lookup table is 'Microsoft Entra ID'?

I know this one! You're screwed! Well, not completely, but I can tell you that dataflow will not help you, nor will any of the built-in data import tools normal users have access to. Setting the lookup reference needs to use a key, and you don't have one in this virtual table, and you can't add one. Even if I use an external system to look up the Entra UUIDs in advance, I was still not able to do an import using dataflow, nor a CSV nor excel upload. There was one CSV import option available only to global admins in my tenant, and I was not able to test that,…


Curtir

Convidado:
14 de dez. de 2023

You are a genious! Thanks for solving my main pain - now we can sync using Dataflow !!!!

Curtir

Convidado:
06 de dez. de 2023

Might want to add that alternate Keys are not officially supported in DataVerse for Teams ?

Curtir
bottom of page