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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DavidH
Helper I
Helper I

Hopefully a simple answer!!

I have been struggling with arranging or segregating tables based upon values from another table.

 

I have got a simple example for illustration of my problem.

 

Table 1 is a main table that is brought in to PowerBI

Table 2 is a table I want to use to 'extract' or create a new table with those values shown out of Table 1

Table 3 would be the resulting table I am after

 

I have tried to use CALCULATETABLE using EXCEPT or FILTER but I am not able to get what I am after. I appreciate that using the EXCEPT context will give me everything except the values I want but is there any way I can get the values I want and ignore that ones not on the list (Table 2)?

 

I have no relationships set up on these so I am wondering if the TREATAS function could be used as a virtual relationship or if there is something that will simply capture this?

 

Table 2 could be a Table that is created using DISTINCT or VALUES from something else either outside or within PowerBI depending on the scenario I am after.

 

Table picture.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I'm not sure what you're exactly after... My guess is that you want to create a new table via DAX in the model based on Table1 and Table 2.

 

To create the new table is rather easy.

 

Table 3 =
CALCULATETABLE(
	'Table 1',
	TREATAS(
		'Table 2',
		'Table 1'[Code]
	)
)

Another way is to create a relationship from 'Table 1'[Code] to 'Table 2'[Code] (*:1) and then

Table 3 =
CALCULATETABLE(
	'Table 1',
	'Table 2'
)

 

Best

Darek

View solution in original post

1 REPLY 1
Anonymous
Not applicable

I'm not sure what you're exactly after... My guess is that you want to create a new table via DAX in the model based on Table1 and Table 2.

 

To create the new table is rather easy.

 

Table 3 =
CALCULATETABLE(
	'Table 1',
	TREATAS(
		'Table 2',
		'Table 1'[Code]
	)
)

Another way is to create a relationship from 'Table 1'[Code] to 'Table 2'[Code] (*:1) and then

Table 3 =
CALCULATETABLE(
	'Table 1',
	'Table 2'
)

 

Best

Darek

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.