Forum Discussion

Universe24's avatar
Universe24
Frequent Visitor
3 years ago
Solved

Column values into other table

Hello Experts,

 

I have below two tables.  I want to insert table 1 HR spends into table 2 HR spends where they are 0

  Tab 1

TowerTeamSpends 
HRSalary20
HRTeam outing500
HRTransport200
HRSalary500
HRTeam outing500
HRTransport500
HRSalary200
HRTeam outing500

 

Tab 2

TowerTeamSpends 
HRSalary0
HRTeam outing500
adminTransport200
adminSalary500
OperationsTeam outing0
HRTransport500
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Universe24 ,

     

    I think you can try code as below.

    New Spends = 
    IF (
        Table2[Spends] = 0,
        SUMX (
            FILTER ( Table1, Table1[Tower] = Table2[Tower] && Table1[Team] = Table2[Team] ),
            Table1[Spends]
        ) + 0,
        Table2[Spends]
    )

    Result:

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • Universe24 , A new column in DAX

     

    Sumx(filter(Table1, Table1[Tower] = Table2[Tower] && Table[Team] = Table2[Team]), Table1[Spend])

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Universe24 ,

     

    I think you can try code as below.

    New Spends = 
    IF (
        Table2[Spends] = 0,
        SUMX (
            FILTER ( Table1, Table1[Tower] = Table2[Tower] && Table1[Team] = Table2[Team] ),
            Table1[Spends]
        ) + 0,
        Table2[Spends]
    )

    Result:

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.