Forum Discussion

BIuser45's avatar
BIuser45
Frequent Visitor
3 years ago

How do I use DAX to append two columns from two different tables?

I have column A from Table A and column B from Table B. Both columns have the column header called, Categories. How do I use DAX to append both columns? 

3 Replies

  • BIuser45 you can use UNION function:

     

    Table C = UNION ( VALUES ( TableA[Category] ), VALUES ( TableB[Category] ) )

     

    👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo

    If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤️

    • BIuser45's avatar
      BIuser45
      Frequent Visitor

      I tired it, but I found I can't due that DAX field or table C for the legend of a donut chart or the row of a matrix. Is there a way to make table C as a field that could used as a legend, row or column of a chart?

  • Hi,

    You should ideally do this in the Query Editor.  Use the Append tables feature there and remove columns other than the Category column.  Remove duplicates from the Category column.  Then create relationships (Many to One and Single) from the 2 tables to the single column appended table.