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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Yaro
Frequent 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])

SecondTable = ADDCOLUMNS(
"Team","Team1",
"Sales", 100,
"Revenue", 20)

return union(FirstTable,SecondTable)


So for example First table is:
Sales Revenue
Team1 500 300

But then it is overwrites SecondTable inputs and I get at the end:
           Sales Revenue
Team1 500 300
Team2 500 300

It supposed to be:

            Sales Revenue
Team1 500 300
Team2 100 20

Somehow measures from FirstTable overwrite values from SecondTable.

I need not to mix them.

What I am doing wrong?

Thank you

6 REPLIES 6
tamerj1
Super User
Super User

HI @Yaro 
Please try

=
VAR T1 =
    ROW (
        "Team", "Team1",
        "Sales", SUM ( InitialTable[Sales] ),
        "Revenue", SUM ( InitialTable[Revenue] )
    )
VAR T2 =
    ROW ( "Team", "Team1", "Sales", 100, "Revenue", 20 )
RETURN
    UNION ( T1, T2 )
Yaro
Frequent Visitor

hi @Tameer
thank you for your reply
Row will return only one row of data?
The example I have given is just to showcase the situation
in fact I need to group those tables by many teams

@Yaro 

group them based on what?

Yaro
Frequent Visitor

I think the answer is to Union tables on row level and then summarize the final output

FreemanZ
Super User
Super User

hi @Yaro 

UNION is not supposed to overwrite values. Could you paste some sample data?

Yaro
Frequent Visitor

hi @FreemanZ 

I have InitialTable for Team1 which looks like this:

MemberSalesRevenue
Member1300200
Member2200100


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

TeamSalesRevenue
Team1500300
Team2500300


Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.