Forum Discussion

as3znaus's avatar
as3znaus
Helper I
9 years ago
Solved

SUM by Project

Hi,

 

I have the following columns in my model:

 

I'd like the column "Coste Consolidado" to sum all values in "Coste Mensual Estimado" BY PROJECT ( "Código"). 

As you can see, at the moment I am getting the sum of all projects.

 

¿any idea?

 

Thanks!

 

 

 

  • Baskar's avatar
    Baskar
    9 years ago

    Cool ,

     

    Coste Consolidado = var Project =  Estimados[Código]

    var Result = calculate ( sum ( Estimados[Coste Mensual Estimado ])
      , filter (all(Estimados) , Estimados[Código]=Project ) )

     

    Return Result

     

     

    Try this one as a Cal Column 

     

     

6 Replies

  • I think I've solved it using "Group By" in Edit Queries...but still, if someone knows a better option I would like to hear it!

     

     

    • itchyeyeballs's avatar
      itchyeyeballs
      Impactful Individual

      I'd consider making a measure for this rather than a calculated column, would give you more flexibility to slice and filter later on.

    • Baskar's avatar
      Baskar
      Resident Rockstar

      Cool ,

       

      Coste Consolidado = var Project =  Estimados[Código]

      var Result = calculate ( sum ( Estimados[Coste Mensual Estimado ])
        , filter (all(Estimados) , Estimados[Código]=Project ) )

       

      Return Result

       

       

      Try this one as a Cal Column 

       

       

      • as3znaus's avatar
        as3znaus
        Helper I

        Thanks itchyeyeballs and Baskar!

         

        I got my Coste Consolidado, but now I want to sum my Actual Cost to Origin.

         

         

        I need "Coste Actual Estimado" to be an accumulated value, something like this:

         

         Coste Mensual EstimadoCoste Total 2015Coste Actual Estimado
        Month05050
        January05050
        February05050
        March05050
        April05050
        May05050
        June05050
        July155065
        August105075
        September155090
        October 05090
        November 3550125
        December4050165