Forum Discussion

RickardBengzon's avatar
RickardBengzon
Frequent Visitor
4 years ago
Solved

SUM values in one table from another table

I have two tables. They are connected by date. And Date in table one is Unique.

I want to sum the values from table2 two in a column in table one.

 

Any tips?

 

 

  • Hi RickardBengzon 

    Try this,

    Sum of Value = 
        var _value = CALCULATE(SUM(Table2[Value]),FILTER(ALL(Table2),Table2[Date]=MIN(Table1[Date])))
    return IF(ISBLANK(_value),0,_value)

    Best Regards,

    Community Support Team _Tang

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

6 Replies

  • v-xiaotang's avatar
    v-xiaotang
    Community Support

    Hi RickardBengzon 

    Try this,

    Sum of Value = 
        var _value = CALCULATE(SUM(Table2[Value]),FILTER(ALL(Table2),Table2[Date]=MIN(Table1[Date])))
    return IF(ISBLANK(_value),0,_value)

    Best Regards,

    Community Support Team _Tang

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

    • RickardBengzon's avatar
      RickardBengzon
      Frequent Visitor

      I don't get any result from that If I remove "CALCULATE" and only use sum I get the total sum of all value for all dates

      • Fowmy's avatar
        Fowmy
        Super User

        RickardBengzon 

        Please try this:

        Total = 
        SUMX( 
            FILTER( Table2 ,  Table2[Date]  = Table1[Date] ),
            Table2[Value]
        )