Forum Discussion
Yaro
3 years agoFrequent Visitor
Union table without inheriting sum
Hi. I need help please. Need to join 2 tables in DAX, so code goes like this: FirstTable = ADDCOLUMNS( "Team","Team1", "Sales", sum(InitialTable[Sales], "Revenue", sum(InitialTable[Revenue]) ...
FreemanZ
Super User
3 years agohi Yaro
UNION is not supposed to overwrite values. Could you paste some sample data?
Yaro
3 years agoFrequent Visitor
hi FreemanZ
I have InitialTable for Team1 which looks like this:
| Member | Sales | Revenue |
| Member1 | 300 | 200 |
| Member2 | 200 | 100 |
So I write code summarizing that table.
var FirstTable=ADDCOLUMN ("Team","Team1","Sales",sum(InitialTable[Sales]),sum(InitialTable[Revenue]))
then I want to add Team2 just with dummy numbers
var SecondTable={("Team2",0,0)}
return union(FirstTable,SecondTable) gives me that result
| Team | Sales | Revenue |
| Team1 | 500 | 300 |
| Team2 | 500 | 300 |
Thank you.