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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
gingersnapx
New Member

How to build a database mapping Responsible Names and their specific job scopes in Power BI

Hello,

I got stuck with building a database in Power BI which shows who is responsible for what product scope.

Now I have two tables:

  • Table (i) shows the structure of product scope (basket < category < group)
  • Table (ii) shows who is responsible for what

Table (i)


Group        

Category

Basket 

Fruit112
Fruit113
Fruit214
Fruit315
Fruit416
Fruit417
Fruit418
Vegetable819
Vegetable820

 

Table (ii)


Responsible NameGroupCategory  Basket  Explanation
AFruitAllAllA manages all baskets under group Fruit
BFruit4AllB manages all baskets under Category 4 under group Fruit
CFruit112C manages basket 12
CFruit416C manages basket 16
DVegetable8AllD manages all baskets under Category 8 under group Vegetable

 

I wonder if it possible to build some identifiers which can translate/break down the "All" in table (ii) by the structure in table (i), and eventually enable me to visualize in a table that looks like below, so users would not need to compare two tables at the same time to find out the specific baskets each is responsible for.


Responsible Name Group Category Basket 
AFruit112
AFruit113
AFruit214
AFruit315
AFruit416
AFruit417
AFruit418

Your help would be much appreciated!!!

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @gingersnapx 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table1:

b1.png

Table2:

b2.png

 

You may apply the following transformations in 'Advanced Editor' for 'Table2'.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUXIrKs0sAdKOOTlQMlYnWskJScYESdwZSdwQhI0whEHKDc3Awi5AZlhqempJYlJOKpBtATMpFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Responsible Name" = _t, Group = _t, Category = _t, Basket = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Responsible Name", type text}, {"Group", type text}, {"Category", type text}, {"Basket", type text}}),
    Custom1 = Table.TransformRows(#"Changed Type",
(x)=>
[Responsible Name=x[Responsible Name],Group=x[Group],Category= if x[Category]="All" then Table.SelectRows(Table1,(y)=>y[Group]=x[Group])[Category] else  
  List.Transform( Text.ToList(x[Category]),Number.From),Basket=x[Basket]  ]
),
    #"Converted to Table" = Table.FromList(Custom1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"Responsible Name", "Group", "Category", "Basket"}, {"Responsible Name", "Group", "Category", "Basket"}),
    Custom2 = Table.TransformRows(#"Expanded Column1",
(x)=>[
     Responsible Name = x[Responsible Name],
     Group = x[Group],
     Category = x[Category],
     Basket = 
     if List.Count(x[Category])>1
     then Table.SelectRows(Table1,(y)=>y[Group]=x[Group])[Basket]
     else if x[Basket]="All"
          then Table.SelectRows(Table1,(z)=>z[Group]=x[Group] and z[Category]=Number.From( List.First(x[Category])) )[Basket]
          else {x[Basket]}

]
),
    #"Converted to Table1" = Table.FromList(Custom2, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column2" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"Responsible Name", "Group", "Category", "Basket"}, {"Responsible Name", "Group", "Category", "Basket"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Column2", "Custom", each let
l=List.Zip({[Category],[Basket]}),
res=List.Transform(l,(x)=>Record.FromList({x{0},x{1}},{"Category","Basket"}))
in 
res),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Category", "Basket"}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Removed Columns", "Custom"),
    #"Expanded Custom1" = Table.ExpandRecordColumn(#"Expanded Custom", "Custom", {"Category", "Basket"}, {"Category", "Basket"}),
    #"Filled Down" = Table.FillDown(#"Expanded Custom1",{"Category"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Filled Down",{{"Responsible Name", type text}, {"Group", type text}, {"Category", Int64.Type}, {"Basket", Int64.Type}})
in
    #"Changed Type1"

 

Result:

b3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @gingersnapx 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table1:

b1.png

Table2:

b2.png

 

You may apply the following transformations in 'Advanced Editor' for 'Table2'.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUXIrKs0sAdKOOTlQMlYnWskJScYESdwZSdwQhI0whEHKDc3Awi5AZlhqempJYlJOKpBtATMpFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Responsible Name" = _t, Group = _t, Category = _t, Basket = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Responsible Name", type text}, {"Group", type text}, {"Category", type text}, {"Basket", type text}}),
    Custom1 = Table.TransformRows(#"Changed Type",
(x)=>
[Responsible Name=x[Responsible Name],Group=x[Group],Category= if x[Category]="All" then Table.SelectRows(Table1,(y)=>y[Group]=x[Group])[Category] else  
  List.Transform( Text.ToList(x[Category]),Number.From),Basket=x[Basket]  ]
),
    #"Converted to Table" = Table.FromList(Custom1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"Responsible Name", "Group", "Category", "Basket"}, {"Responsible Name", "Group", "Category", "Basket"}),
    Custom2 = Table.TransformRows(#"Expanded Column1",
(x)=>[
     Responsible Name = x[Responsible Name],
     Group = x[Group],
     Category = x[Category],
     Basket = 
     if List.Count(x[Category])>1
     then Table.SelectRows(Table1,(y)=>y[Group]=x[Group])[Basket]
     else if x[Basket]="All"
          then Table.SelectRows(Table1,(z)=>z[Group]=x[Group] and z[Category]=Number.From( List.First(x[Category])) )[Basket]
          else {x[Basket]}

]
),
    #"Converted to Table1" = Table.FromList(Custom2, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column2" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"Responsible Name", "Group", "Category", "Basket"}, {"Responsible Name", "Group", "Category", "Basket"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Column2", "Custom", each let
l=List.Zip({[Category],[Basket]}),
res=List.Transform(l,(x)=>Record.FromList({x{0},x{1}},{"Category","Basket"}))
in 
res),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Category", "Basket"}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Removed Columns", "Custom"),
    #"Expanded Custom1" = Table.ExpandRecordColumn(#"Expanded Custom", "Custom", {"Category", "Basket"}, {"Category", "Basket"}),
    #"Filled Down" = Table.FillDown(#"Expanded Custom1",{"Category"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Filled Down",{{"Responsible Name", type text}, {"Group", type text}, {"Category", Int64.Type}, {"Basket", Int64.Type}})
in
    #"Changed Type1"

 

Result:

b3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This is amazing!! Thanks Allan!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.