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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
emmawdmi22
Helper I
Helper I

Custom expanding rows based on other table data

Hello,

I'm fairly new to Power query, and I would appreciate some help with my current data.

 

Context: I have two tables, one called devices with deviceIds and their displayName (which can be "Machine", "Printer 1 & 2", "Printer 3 & 4", "Printer 5 & 6"). The other table, which is connected to it in the model by a one to many relationship, is called data. It has the matching deviceIds, a timestamp, and columns counter0, counter1, and counter2.

 

Issue: I want to be able to compare the counter data to each other in a new table that includes deviceId and counter (and displayName if that makes life easier for determining which value). I would like all deviceIds with displayName Machine to have counter = counter0 (from data table). For displayNames Printer 1 & 2, Printer 3 & 4, Printer 5 & 6, I want to make two rows for each input from the data table, one with counter = counter1 (for the odd # in the name) and one with counter = counter2 (for the even # in the name).

 

 

I don't know if this is even possible, but I thought I would give this a shot. I need to use powerquery and not dax for this because I have other grouping and manipulation to do afterwards. Thanks for your help!

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @emmawdmi22 

 

Assume your original tables are like below, 

vjingzhang_0-1656664614313.png

Is this what you want to have in a new table?

vjingzhang_1-1656664630250.png

 

You can download the attached pbix at bottom to see detailed steps for the third table. I use Merge queries as new feature to create the new table.

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @emmawdmi22 

 

Assume your original tables are like below, 

vjingzhang_0-1656664614313.png

Is this what you want to have in a new table?

vjingzhang_1-1656664630250.png

 

You can download the attached pbix at bottom to see detailed steps for the third table. I use Merge queries as new feature to create the new table.

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

This works perfectly! Thank you so much for your help!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.