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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
SJ_PPM_BI
Regular Visitor

Adding rows based on a unique value

Hi

I am fairly new to M Query and need some help with the following:

I have two Queries. Query1 and Query 2. Both have unique values. I need the column in Query 2 to be added to Query 1 for each row in Query2. It is better explained as per below:

SJ_PPM_BI_1-1718131322307.png

Final Outcome:

SJ_PPM_BI_2-1718131401336.png

Any tips or tricks and guidance will be highly appreciated.

 

THANKS!

 

SJ

 

1 ACCEPTED SOLUTION
Kaviraj11
Super User
Super User

Hi,

 

To perform the cross join, firstly, you will need to add a custom column in both the table and give a value as = 1

Kaviraj11_0-1718133238534.png

 

Then do a left join from query 1 to query 2 on Custom column. Lastly, you will need to expand the column.

 

Kaviraj11_1-1718133317194.png

 

If you need any other help, let me know.

 

 




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

Proud to be a Super User!





View solution in original post

4 REPLIES 4
mukhan311
Frequent Visitor

Hi @SJ_PPM_BI ,

 

there are  acouple of steps that you will need to follow.

1. for query 2 first I transpose the data. you will get the result as depicted below.

mukhan311_0-1718133311499.png

2. append the query. 

mukhan311_1-1718133358749.png

3. Using fill option fill down on the columns for query 2

mukhan311_2-1718133404927.png

4. use unpivot other column option on column Project name.

mukhan311_3-1718133875595.png

5. Filter out the null values from project name and detlete the column attribute.

If this works pleae mark it as a soltuion. 

Thanks.

SJ_PPM_BI
Regular Visitor

Thank you very much!
So simple. I was looking at all sorts of things such as Table Combine etc. Most searches seems to guide towards using a "sledge hammer" for what I needed. 🙂

 

Many THANKS again!

 

SJ

Kaviraj11
Super User
Super User

Hi,

 

To perform the cross join, firstly, you will need to add a custom column in both the table and give a value as = 1

Kaviraj11_0-1718133238534.png

 

Then do a left join from query 1 to query 2 on Custom column. Lastly, you will need to expand the column.

 

Kaviraj11_1-1718133317194.png

 

If you need any other help, let me know.

 

 




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

Proud to be a Super User!





This worked perfectly! Thank you so much!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.