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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Matrix visual without merging

Hello

 

I have data in the format:

 

IDCountry1Country2
1Y 
2 Y
3YY

 

IDType
1A
2B
3C

 

How can I create a pivot visual that will show:

 Country1Country1Country2Country2
 Y(blank)Y(blank)
Type    
A    
B    
C    

 

I would prefer to do so without merging the tables, just by specifying a data model relationship, is that possible?

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

 

How about create a new pivot table by using DAX:

New Pivot Table = 
var _t1=SELECTCOLUMNS('Table',"ID",[ID],"Country Type","Country1","If Y",[Country1]) 
var _t2= SELECTCOLUMNS('Table',"ID",[ID],"Country Type","Country2","If Y",[Country2]) 
return UNION(_t1,_t2)

Eyelyn9_0-1648695488526.png

And then build relationship between it and the second table:

Eyelyn9_1-1648695522103.png

Then create a Matric visual:

Eyelyn9_2-1648695543640.png

 

Best Regards,
Eyelyn Qin
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

3 REPLIES 3
Anonymous
Not applicable

Hi  @Anonymous ,

 

How about create a new pivot table by using DAX:

New Pivot Table = 
var _t1=SELECTCOLUMNS('Table',"ID",[ID],"Country Type","Country1","If Y",[Country1]) 
var _t2= SELECTCOLUMNS('Table',"ID",[ID],"Country Type","Country2","If Y",[Country2]) 
return UNION(_t1,_t2)

Eyelyn9_0-1648695488526.png

And then build relationship between it and the second table:

Eyelyn9_1-1648695522103.png

Then create a Matric visual:

Eyelyn9_2-1648695543640.png

 

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

Anonymous
Not applicable

@amitchandak  thanks but as I underline in bold letters, I have two separate tables and I do not want to merge them nor combine them in one table permanently but instead use data modelling to specify a relationship. Is there a solution for this?

Thanks!

amitchandak
Super User
Super User

@Anonymous , I think This problem has been asked and I shared file. Sharing it again

 

Check operation in power query and mtrix on Page 2

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.