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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Full outer join using calculated columns

Hello Folks,

 

AFAIK, we cannot Join tables using calculated columns. But, I am now in a tricky situation that,

 

I have TableA and TableB. 

TableA has calculated columns( NOT custom columns.). These calculated columns are created at PowerBI level using DAX but not in PQ. On the other hand, I have TableB which I would like to join with. Could you provide any idea/approach to deal this.

 

In the below illustration, TableA and TableB should be joined. In the output table, ALL the rows from TableB should be displayed with the associated SPENDS data from TableA. Also, this should happen for both the years 2021 and 2020 and  GROUPBY(Year,Row) SUM(Spends)

 

TableA    
 PostingYear
(calculated column)
GroupID
(calculated column)
GroupDetail
(calculated column)
ApprovedSpend
 20221IC - SynGroup100
 20223Total debt (Group)500
 20211IC - SynGroup400
 20224Proj Exp Alloc800
 20215Additional Costs50
 20221IC - SynGroup

900

 

TableB  
 GroupIDGroupDetail
 1Incurred Costs
 2Cost group - Academia 
 3Total debt (Group)
 4Projected Expenditure
 5Additional Incurred Costs

 

ExpectedOutput    
 PostingYearGroupIDGroupDetailSpends
 20221Incurred Costs1000
 20222Cost group - Academia 0
 20223Total debt (Group)500
 20224Projected Expenditure800
 20225Additional Incurred Costs0
 20211Incurred Costs400
 20212Cost group - Academia 0
 20213Total debt (Group)0
 20214Projected Expenditure0
 20215Additional Incurred Costs50
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You could get the result by creating a measure.

Measure = 
var _value = CALCULATE(SUM(TableA[ApprovedSpend]),FILTER(ALLSELECTED(TableA),TableA[PostingYear]=SELECTEDVALUE(TableA[PostingYear])&&TableA[GroupID]=SELECTEDVALUE(TableB[GroupID])))
return
_value+0

vjaywmsft_0-1650446204387.png

 

Best Regards,

Jay

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

You could get the result by creating a measure.

Measure = 
var _value = CALCULATE(SUM(TableA[ApprovedSpend]),FILTER(ALLSELECTED(TableA),TableA[PostingYear]=SELECTEDVALUE(TableA[PostingYear])&&TableA[GroupID]=SELECTEDVALUE(TableB[GroupID])))
return
_value+0

vjaywmsft_0-1650446204387.png

 

Best Regards,

Jay

amitchandak
Super User
Super User

@Anonymous , rename the column of Table 2 or use selectcolumns in next code to change name. I am assuming rename appending 1

 

Addcolumns(

crossjoin(Table1, Table2) , "New Spend", if( [GroupID] = [GroupID 1], [Spend], 0) )

 

Crossjoin does not take the same column name

 

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

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
Anonymous
Not applicable

@amitchandak 

Thanks for the help! 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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