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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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