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
Gurps
Frequent Visitor

How to extract each value from a range into a separate table?

I have one table, let's call it "User Dimension Values"  that has the following layout:

Gurps_0-1690364816141.png

 

User IDDimensionDimension Values
User ADimension A100..208
User BDimension A100..202|204..205

 

This is linked with another table, let's call it "Dimension Table" which will have the following layout:

Gurps_0-1690364851877.png

 

Dimension CodeCode
Dimension A050
Dimension A100
Dimension A201
Dimension A202
Dimension A203
Dimension A204
Dimension A205
Dimension A208

 

I want to use Power Query to create a third table inside Power Bi which would then have the following format:

Gurps_1-1690364936778.png

 

 

User IDDimensionCode
User ADimension A100
User A Dimension A201
User A Dimension A202
User A Dimension A203
User A Dimension A204
User A Dimension A205
User A Dimension A208
User B Dimension A100
User B Dimension A201
User B Dimension A202
User B Dimension A204
User B Dimension A205

 

So how do I take the values in the "Dimension Values" column from the "User Dimension Values" Table and use the ranges such as 

  • 100..208
  • 100..202|204..205

To then produce a table that will show me row by row each dimension value assigned to each user from the range?

 

Thanks

 

 

 

1 ACCEPTED SOLUTION
slorin
Super User
Super User

More simple

let
Source = #"User Dimension Values",
List = Table.AddColumn(Source, "Dimension Values 2", each Expression.Evaluate("{" & Text.Replace([Dimension Values], "|", "} & {") & "}")),
Expand = Table.ExpandListColumn(List, "Dimension Values 2"),
Join_Inner = Table.NestedJoin(Expand, {"Dimension", "Dimension Values 2"}, #"Dimension Table", {"Dimension Code", "Code"}, "Dimension Table", JoinKind.Inner)
in
Join_Inner

Stéphane 

View solution in original post

3 REPLIES 3
slorin
Super User
Super User

More simple

let
Source = #"User Dimension Values",
List = Table.AddColumn(Source, "Dimension Values 2", each Expression.Evaluate("{" & Text.Replace([Dimension Values], "|", "} & {") & "}")),
Expand = Table.ExpandListColumn(List, "Dimension Values 2"),
Join_Inner = Table.NestedJoin(Expand, {"Dimension", "Dimension Values 2"}, #"Dimension Table", {"Dimension Code", "Code"}, "Dimension Table", JoinKind.Inner)
in
Join_Inner

Stéphane 

Gurps
Frequent Visitor

That's incredible.  Thank you so much for the solution.  

slorin
Super User
Super User

Hi

Split "Dimension Values"  by "|" into rows

Convert "100..208" into list with Expression.Evaluate

Expand list

Join with "Dimension Values"  (joinkind = Inner)

 

let
Source = #"User Dimension Values",
Split = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Dimension Values", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Dimension Values"),
Convert_to_list = Table.TransformColumns(Split, {{"Dimension Values", each Expression.Evaluate("{"&_&"}")}}),
Expand = Table.ExpandListColumn(Convert_to_list, "Dimension Values"),
Join_Inner = Table.NestedJoin(Expand, {"Dimension", "Dimension Values"}, #"Dimension Table", {"Dimension Code", "Code"}, "Dimension Table", JoinKind.Inner)
in
Join_Inner

 

 Stéphane

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.