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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Constant value in a column for each table in DAX UNION

Hi All,

 

I'm still learning Power BI DAX and coudn't find a good example in the forum as per my requirement.

 

I have two tables TABLE_A and TABLE_B, I need to UNION these two tables and add a new column with constant value to the result to indicate the row belogs to which table.

 

Example below with expected output and more important is to have the same column headers like "Source", "TSID", "Product" and "Location".

 

Sara_K_0-1678484384786.png

 

Thanks

Sara

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User
3 REPLIES 3
Ahmedx
Super User
Super User

Anonymous
Not applicable

Thanks @Ahmedx 

@AFrathanks for your suggestion, but I wanted to do only using DAX.

AFra
Helper III
Helper III

you can easily do it in on Power query : 

1. you add for each table a column named Source = TABLE A or B

2. append table B on table A

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.