Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I try to Combine two columns from different tables in SSAS Tabular with DAX. I had the follow code to get the two columns
=VAR A = CALCULATETABLE( SUMMARIZE(StockDetail,StockDetail[ProductCode]),FILTER(RELATEDTABLE(Product),Product[code]))
VAR B =CALCULATETABLE( SUMMARIZE(Product,Product[code]),FILTER(RELATEDTABLE(StockDetail),StockDetail[ProductCode]))
VAR result = A
RETURN result
At moment I only have one column, I would like to have a bridge table with the two columns "StockDetail[code]" and "product[code]".
thanks,
pm
Solved! Go to Solution.
Hi, @Anonymous ;
Try it.
Filtered Bridge =
VAR _a= DISTINCT(UNION(VALUES(A[Itema]),VALUES(B[ItemB])))
var _add=ADDCOLUMNS(FILTER( _a,[Itema]<>BLANK()),"Item A",CALCULATE(MAX('A'[Itema]),FILTER('A',[Itema]=EARLIER([Itema]))),"Item B",CALCULATE(MAX('B'[ItemB]),FILTER('B',[ItemB]=EARLIER([Itema]))))
return SUMMARIZE( _add,[Item A],[Item B])
The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous ;
Try it.
Filtered Bridge =
VAR _a= DISTINCT(UNION(VALUES(A[Itema]),VALUES(B[ItemB])))
var _add=ADDCOLUMNS(FILTER( _a,[Itema]<>BLANK()),"Item A",CALCULATE(MAX('A'[Itema]),FILTER('A',[Itema]=EARLIER([Itema]))),"Item B",CALCULATE(MAX('B'[ItemB]),FILTER('B',[ItemB]=EARLIER([Itema]))))
return SUMMARIZE( _add,[Item A],[Item B])
The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous ;
Try it.
measure =
VAR A =
SUMMARIZE ( StockDetail, StockDetail[ProductCode] )
VAR B =
SUMMARIZE ( Product, Product[code] )
RETURN
SUMMARIZE ( UNION ( A, B ), [code] )
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Yalan Wu,
Great your help, but I yould like to see the two columns side by side.Union gives me only one column. And by the way you can't put in the same column a stocklineID and a productID
Cheers
Hi, amitchandak
At moment I'm using SSAS tabular. and I try to create a bridge table between
stockdetail table and Product that have the stockdetailID and productID.
@Anonymous, Are you using a live connection? Then I doubt that will work in power bi.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
22 | |
10 | |
10 | |
9 | |
7 |