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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Merging of Columns

Hi All,

 

I am trying to merge columns from different queries (used four queries) in Power BI Desktop using Manage Relationship by Many to Many Cardinality. But, could find that only common data can be filtered in report. 

 

Columns from Different Queries and SlicerColumns from Different Queries and Slicer

Please check the screenshot where I am not able to filter CC Field using slicer.

Kindly, suggest me some solution.

 

Regards,

Vineetha

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Eads,

 

Found the solution for merging columns from different queries having different number of columns.

 

Below is the code:

 

TABLE = DISTINCT(
		  UNION ( SELECTCOLUMNS(TABLE1,"COLUMN",TABLE1[COLUMN]),
                           SELECTCOLUMNS(TABLE2,"COLUMN",TABLE2[COLUMN])
			)
		  )

After giving the code, need to manage relationships using all queries by Many to Many Cardinality.

 

 

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

 

Regards,

Vineetha.

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi Eads,

 

Found the solution for merging columns from different queries having different number of columns.

 

Below is the code:

 

TABLE = DISTINCT(
		  UNION ( SELECTCOLUMNS(TABLE1,"COLUMN",TABLE1[COLUMN]),
                           SELECTCOLUMNS(TABLE2,"COLUMN",TABLE2[COLUMN])
			)
		  )

After giving the code, need to manage relationships using all queries by Many to Many Cardinality.

 

 

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

 

Regards,

Vineetha.

 

Hi @Anonymous ,

 

I am glad that you found the right solution for your question.

 

Best Regards,

Eads

 

If my previous post helps, then please consider Accept it as the solution to help the others to find it more quickly.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

Hi Eads,

 

This solution works only for queries haivng equal no of columns but not in other case.

Kinldy let mw know, if theres a way to achieve this.

 

Regards,

Vineetha

v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need to create a new table with Union() function to be a slicer.

SlicerTable =
DISTINCT ( UNION ( AR, cc, Inventory, 'Sales CC' ) )

Then create relationships with other four tables. The relationships must be active ones.

 

merge.PNG

 

Now you can create your reports.

 

report1.PNG

 

Best Regards,

Eads

 

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

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.