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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
PowerBIUser9901
Advocate II
Advocate II

Dynamically return an associated value from my dimension table to my data table

Hi, I need guidance in how I can dynamically return an associated value from my dimension table to my data table. (Data file included in link below).


In the screenshot below you’ll notice that the data table Region column contains both countries and regions. I’m trying to take the regions (highlighted in green) such as “LATAM” and “U.S – All States” and instead return the associated countries/states in a list view (such as in the Desired Output table).

 

Current & Desired Data.jpg
The associations should dynamically update from the dimension table as the dimension table can be updated to include additional countries. (Dimenstion Table Screenshot Below)

 

Region Dimension Table.jpg


I also have the ability to change my dimension table in any way such changing and or adding column fields in order to make this happen.

 

The data file can be downloaded in the link below:

https://1drv.ms/x/s!AltxA49hBwkYgetjYs-nNNezkuaRPw?e=dQp0fh

 

I appreciate any help you can provide. Thank you!

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @PowerBIUser9901 ,

 

Chech this file: Download PBIX 

I've made some changes regards to the group names, once you are able to do it.

 

Capture.PNG

 

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

7 REPLIES 7
camargos88
Community Champion
Community Champion

Hi @PowerBIUser9901 ,

 

Chech this file: Download PBIX 

I've made some changes regards to the group names, once you are able to do it.

 

Capture.PNG

 

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Wow! This is exactly what I'm looking for, Thank you! Could you please explain the m code logic in order to make this happen. I may try to do this for similar cases. 

Hi @PowerBIUser9901 ,

 

I'm glad it worked.

 

The function looks for rows with  [Region Type] = "Country/Territory" and some match on [DataTable Value] / [Assosiated Region] / [Location] using the _region variable defined before (it is necessary to compare between tables).

It returns a list of [DataTable Value] and combines using the function Text.Combine.

 

Be aware that was required to apply a trim function on the columns to remove the spaces (begin and end).

 

This is the code:

let _region = [Region] in
Text.Combine(Table.SelectRows(DimensionTable,
each [Region Type] = "Country/Territory"
and (
[DataTable Value] = _region or
[Assosiated Region] = _region or
[Location] = _region
)
) [DataTable Value], ", ")

 

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Thank you so much for the explanation. I noticed that you changed the DataTable row values text. How would you apply this logic if you can only change the Dim table however not change the row values orignal text in the Data Table.

Example: "International - All" can not be changed in the DataTable to "International", however you do have complete control over the Dimension Table.

@PowerBIUser9901 ,

 

If I got your point correctly... 

 

You should have all the correspondencies on the Region Dimension Table, specially for the grouped values like International - All, Europe and US.

 

Can you change the value "Internacional" to "International - All" on Region Dimension Table ? And do it with other values like Europe to EU - All and U.S. State/Territory to U.S. - All States ?

 

If no, let me know to create another solution.

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Hi Ricardo,

I do have the ability to modify the dimension table. When I tried your suggested modifications, I ended up getting blanks for some of the countries/regions. Could you provide an example of how you would create the list via the custom column though not change the data table Region values? I appreciate any guidance you can provide.

Hi @PowerBIUser9901 ,

 

Check the file again: Download PBIX 

 

I changed the [Assosiated Region] for the grouped values to:

Capture.PNG

 

and some hard code:

Capture1.PNG



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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