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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
kierenjblake
New Member

Consolidating multiple data items into fewr choices

Hello PBi hive brain,

 

I am populating a SP list using MS Forms, part of the form records the reporters' department from a fixed list choice, when this is brouhght into PBI I want to relate each department into it's over-arching Section. The relationship between the two is shown in the table below I have in my pbi.

My question is how do I populate a new column in the main table using the below table as a key/relationship defintiion? i.e. Everytime the DEPT = Business Improvement, the new column would show "Other", whenever DEPT = Cabin Maintenance, the new column would show "Part-145" etc.

kierenjblake_0-1746616364642.png

Many Thanks

1 ACCEPTED SOLUTION
BeaBF
Super User
Super User

@kierenjblake Hi! You can do this with a merge.

1. In Power Query:
Go to Home > Merge Queries

Select your Form responses table as the primary table.

Select your Mapping table as the secondary table.

Join them on the Department column.

Use a Left Outer Join (keep all from Form responses, matching from Mapping table)

2. Expand the Section:
After merging, click the expand icon on the new column (from your Mapping table)

Select only the Section column to add.

Rename it to something clear like Department Section

3. Close & Apply:
Load the data back into Power BI and you're set.

 

If you paste the advanced editors of the tables, i can fix your code.

 

BBF


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

👍 Kudos are appreciated

🔥 Proud to be a Super User!

Community News image 1920X1080.png

View solution in original post

4 REPLIES 4
jennratten
Super User
Super User

Hello @kierenjblake - you can achieve this by creating a calculated column in Power Query.  This can be done in a few different ways, which I have added below.

Add a conditional column via the UI and build your If/then/else conditions.

jennratten_1-1746620852895.png

Add a custom column via the UI and add your if/then/else code.  You can also do this in the Advanced Editor if you prefer a free-hand code experience.

jennratten_2-1746620939288.png

Add column from examples, select the DEPT column and start typing some examples of the expected result in the column cells.  The query editor will try to figure out the logic needed and will add it for you.

jennratten_3-1746621117125.png

Please let me know if you have any other questions.

 

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

Thanks @jennratten I've got what I needed from BeaBF, but will have a play with your idea too, thanks!

BeaBF
Super User
Super User

@kierenjblake Hi! You can do this with a merge.

1. In Power Query:
Go to Home > Merge Queries

Select your Form responses table as the primary table.

Select your Mapping table as the secondary table.

Join them on the Department column.

Use a Left Outer Join (keep all from Form responses, matching from Mapping table)

2. Expand the Section:
After merging, click the expand icon on the new column (from your Mapping table)

Select only the Section column to add.

Rename it to something clear like Department Section

3. Close & Apply:
Load the data back into Power BI and you're set.

 

If you paste the advanced editors of the tables, i can fix your code.

 

BBF


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

👍 Kudos are appreciated

🔥 Proud to be a Super User!

Community News image 1920X1080.png

Thanks! I'll give this a try and let you know how I get on!

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors