Forum Discussion

Wildglen's avatar
Wildglen
Regular Visitor
8 years ago
Solved

sum columns with same id

Hello,   I have the following table:       I'm trying to create a custom column which sums Hoeveelheid for items with the same SolutionID. So far I've come up with:    Column = SUMX(FILTE...
  • Wildglen's avatar
    8 years ago

    <p>Hello,</p>
    <p>&nbsp;</p>
    <p>I have the following table:</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p><a href="http://nl.tinypic.com?ref=5ukz0l" target="_blank"><img src="http://i67.tinypic.com/5ukz0l.jpg" border="0" alt="Image and video hosting by TinyPic"></a></p>
    <p>&nbsp;</p>
    <p>I'm trying to create a custom column which sums Hoeveelheid for items with the same SolutionID. So far I've come up with:&nbsp;</p>
    <p>&nbsp;</p>
    <p>Column = SUMX(FILTER(tbl_SolutionChemicals;tbl_SolutionChemicals[SolutionID]=tbl_SolutionChemicals[SolutionID]);tbl_SolutionChemicals[Hoeveelheid])</p>
    <p>&nbsp;</p>
    <p>But this returns the sum of all Hoeveelheid rows. Can anyone help me with this?</p>

  • Anonymous's avatar
    Anonymous
    8 years ago

    Dear Wildglen

     

    Please try this:

     

    Column= CALCULATE(SUM(tbl_SolutionChemicals[Hoeveelheid]), ALLEXCEPT(tbl_SolutionChemicals, tbl_SolutionChemicals[SolutionID])  )

     

  • Ashish_Mathur's avatar
    8 years ago

    Hi,

     

    i am assuming that you want to create a calculated column formuls in the PowerPivot.  If that be the case, then try this

     

    =CALCULATE(SUM(tbl_SolutionChemicals[Hoeveelheid]),FILTER(tbl_SolutionChemicals,tbl_SolutionChemicals[SolutionID]=EARLIER(tbl_SolutionChemicals[SolutionID])))

    Hope this helps.