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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
PBI_newuser
Post Prodigy
Post Prodigy

Create dimension table from 2 different tables

Hi, how to create a dimension table from 2 different tables without including the (Blank) value?

Below doesn't work as it includes (Blank) as one of the value which cause many to many relationship.

Country = distinct(union(all(TableA[Country]),all(TableB[Country])))

 

TableA:

Country
(Blank)
USA
Canada
Guam

 

TableB:

Country
USA
Puerto Rico
Australia

 

Dim_Table:

Country
USA
Canada
Guam
USA
Puerto Rico
Australia
1 ACCEPTED SOLUTION

updated version:

Country = 
VAR vFilter = {"","null","(Blank)",BLANK()}
VAR vTableA = SELECTCOLUMNS('Table A',"Country",'Table A'[Country])
VAR vTableAFilter = FILTER(vTableA,NOT( [Country] in vFilter))
VAR vTableB = SELECTCOLUMNS('Table B',"Country",'Table B'[Country])
VAR vTableBFilter = FILTER(vTableB,NOT( [Country] in vFilter))
VAR vUnion = UNION(vTableAFilter,vTableBFilter)

return vUnion

 

This is a more dynamic approach,

1) select define values

2) select columns from source table A | B

3) Filter vTableA|B

4) Union

 

 

View solution in original post

5 REPLIES 5
whereismydata
Resolver IV
Resolver IV

Hi @PBI_newuser 

 

not sure if the most elegant solution, but it works:

 

Country = 
VAR vTableA = SELECTCOLUMNS('Table A',"Country",'Table A'[Country])
VAR vTableAFilter = FILTER(vTableA,[Country] <> BLANK() && [Country] <> "(Blank)" && [Country] <> "" && [Country] <> "" && [Country] <> "null")
VAR vTableB = SELECTCOLUMNS('Table B',"Country",'Table B'[Country])
VAR vTableBFilter = FILTER(vTableB,[Country] <> BLANK() && [Country] <> "(Blank)" && [Country] <> "" && [Country] <> "" && [Country] <> "null")
VAR vUnion = UNION(vTableAFilter,vTableBFilter)

return vUnion

 

 

updated version:

Country = 
VAR vFilter = {"","null","(Blank)",BLANK()}
VAR vTableA = SELECTCOLUMNS('Table A',"Country",'Table A'[Country])
VAR vTableAFilter = FILTER(vTableA,NOT( [Country] in vFilter))
VAR vTableB = SELECTCOLUMNS('Table B',"Country",'Table B'[Country])
VAR vTableBFilter = FILTER(vTableB,NOT( [Country] in vFilter))
VAR vUnion = UNION(vTableAFilter,vTableBFilter)

return vUnion

 

This is a more dynamic approach,

1) select define values

2) select columns from source table A | B

3) Filter vTableA|B

4) Union

 

 

Thank you so much @whereismydata ! It works. 

whereismydata
Resolver IV
Resolver IV

Hi, in DAX or PowerQuery?

 

In PQ you could append those two table and then remove duplicates

Hi @whereismydata , I wanna append two tables in DAX. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors