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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Sabareeshwari
Helper I
Helper I

Need to map Category and SubCategory in another set of Data

I have three excel named Mappings, Report 1 and Report2.

 

Will Import these excels and append the data from Report1 and Report2 and generate new table. in that table i need show category and subcategory based on Mappings and Report Table.

 

Shared Excel Datas for your Reference.

 

Report 1:

CategorySub Category
Door related services - Student RoomCard lost
Common Area services-
Door related services - Student RoomOthers
Common Area services-
Door related services - Student RoomOthers
Door related services - Student RoomCard is not working
Door related services - Student RoomCard lost

 

 

Mapping Table:

 

CHC Service IssuesDropdownsE-Facility CategoryE-Facility Sub Category
Door Related Services - Student Room    
 Type of IssueCard is not workingCarpentryLock and Keys
  Door Lock is not workingCarpentryDoor Repairs
  Card lostCarpentryLock and Keys
  Card brokenCarpentryLock and Keys
  Others  

 

For Example:

If i found Door related services - Student Room in Report 1 then i should check in these mapping table and found corresponding Category and Sub Category and place it in that new appended table. 

 

Is there any option to try the above mentioned logic in PowerBI Report, please suggest any solution.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Sabareeshwari 

You can refer to the code in power query.

Mapping Table

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jVDLCsIwEPyVoef6FXoRBaH1VnqIzaohNRs2qZK/N0Yp9CI9DMzuMg+266ods6ChUUXSaEmeZqCADdo4aXIRDfOjqiss0NddYefkCXzFPoSJ8rxVomECHEe8WKxxt+/WZytJmR95sFBO40ApzD4flCLl/Nfg19crI0t9yR45xNWJRXERtuRWa07xTjl4fkT/Bg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"CHC Service" = _t, Issues = _t, Dropdowns = _t, #"E-Facility Category" = _t, #"E-Facility Sub Category" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"CHC Service", type text}, {"Issues", type text}, {"Dropdowns", type text}, {"E-Facility Category", type text}, {"E-Facility Sub Category", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type"," ",null,Replacer.ReplaceValue,{"CHC Service"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value"," ",null,Replacer.ReplaceValue,{"Issues"}),
    #"Filled Down" = Table.FillDown(#"Replaced Value1",{"CHC Service", "Issues"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Issues] = "Type of Issue"))
in
    #"Filtered Rows"

Report 1

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tZCxCoNAEER/ZdlaPyKYMiAk5WFxeEs89G5gd5P8vsHCJo0WqWfeDDMh8BVQUlmiSyITfedRjFp6+CtJdboDhRvuoiZaYM5DE7hDKah0UYk78zW1m3gwsfdJ1P4Rd2ZSNqpw+kDnXJ+n8f2Rg9Bmu2Gcf4qHFQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Category = _t, #"Sub Category" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Category", type text}, {"Sub Category", type text}}),
    #"Merged Queries" = Table.FuzzyNestedJoin(#"Changed Type", {"Category", "Sub Category"}, #"Mapping Table", {"CHC Service", "Dropdowns"}, "Mapping Table", JoinKind.LeftOuter, [IgnoreCase=true, IgnoreSpace=true]),
    #"Expanded Mapping Table" = Table.ExpandTableColumn(#"Merged Queries", "Mapping Table", {"E-Facility Category", "E-Facility Sub Category"}, {"E-Facility Category", "E-Facility Sub Category"})
in
    #"Expanded Mapping Table"

Output

vxinruzhumsft_0-1720662785371.png

 

 

 

Best Regards!

Yolo Zhu

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

1 REPLY 1
Anonymous
Not applicable

Hi @Sabareeshwari 

You can refer to the code in power query.

Mapping Table

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jVDLCsIwEPyVoef6FXoRBaH1VnqIzaohNRs2qZK/N0Yp9CI9DMzuMg+266ods6ChUUXSaEmeZqCADdo4aXIRDfOjqiss0NddYefkCXzFPoSJ8rxVomECHEe8WKxxt+/WZytJmR95sFBO40ApzD4flCLl/Nfg19crI0t9yR45xNWJRXERtuRWa07xTjl4fkT/Bg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"CHC Service" = _t, Issues = _t, Dropdowns = _t, #"E-Facility Category" = _t, #"E-Facility Sub Category" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"CHC Service", type text}, {"Issues", type text}, {"Dropdowns", type text}, {"E-Facility Category", type text}, {"E-Facility Sub Category", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type"," ",null,Replacer.ReplaceValue,{"CHC Service"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value"," ",null,Replacer.ReplaceValue,{"Issues"}),
    #"Filled Down" = Table.FillDown(#"Replaced Value1",{"CHC Service", "Issues"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Issues] = "Type of Issue"))
in
    #"Filtered Rows"

Report 1

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tZCxCoNAEER/ZdlaPyKYMiAk5WFxeEs89G5gd5P8vsHCJo0WqWfeDDMh8BVQUlmiSyITfedRjFp6+CtJdboDhRvuoiZaYM5DE7hDKah0UYk78zW1m3gwsfdJ1P4Rd2ZSNqpw+kDnXJ+n8f2Rg9Bmu2Gcf4qHFQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Category = _t, #"Sub Category" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Category", type text}, {"Sub Category", type text}}),
    #"Merged Queries" = Table.FuzzyNestedJoin(#"Changed Type", {"Category", "Sub Category"}, #"Mapping Table", {"CHC Service", "Dropdowns"}, "Mapping Table", JoinKind.LeftOuter, [IgnoreCase=true, IgnoreSpace=true]),
    #"Expanded Mapping Table" = Table.ExpandTableColumn(#"Merged Queries", "Mapping Table", {"E-Facility Category", "E-Facility Sub Category"}, {"E-Facility Category", "E-Facility Sub Category"})
in
    #"Expanded Mapping Table"

Output

vxinruzhumsft_0-1720662785371.png

 

 

 

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
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.

Top Solution Authors
Top Kudoed Authors