Forum Discussion

sprakash1192's avatar
sprakash1192
Helper II
6 years ago
Solved

Grouped Sum

I have a summarized table like this:

YearProdFacNameDepartment NameWeekTotal_WCM_EUs
2020TylerWCM29563892.44
2020TylerWCM30589533.76

 

I would like to create a new column that has a total sum grouped by the rows like this :

YearProdFacNameDepartment NameWeekTotal_WCM_EUsTotal
2020TylerWCM29563892.441153426.2
2020TylerWCM30589533.761153426.2

 

How can I do this without create a new summarized table?

  • v-kelly-msft's avatar
    v-kelly-msft
    6 years ago

    Hi  sprakash1192 ,

     

    Or you can use "earlier" function:

    Total = SUMX(FILTER('Table','Table'[Key]=EARLIER('Table'[Key])),'Table'[Total_WCM_EUs])

    And you will see:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!

6 Replies

  • sprakash1192 add a new measure like this:

     

    Total = CALCUATE ( SUM ( Table[TOTAL_WCM} ), ALL() )

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • sprakash1192's avatar
      sprakash1192
      Helper II

      But it takes away all groups. I should have made my question clearer, I want to have a grouped sum by the Key in my table, like this :

      YearProdFacNameDepartment NameWeekKeyTotal_WCM_EUsTotal
      2020TylerWCM2929-30563892.41153426
      2020TylerWCM3029-30589533.81153426
      2020TylerWCM3131-324100009410000
      2020TylerWCM3231-3290000009410000
      • parry2k's avatar
        parry2k
        Super User

        sprakash1192 try this

         

        Total  = 
        CALCULATE ( SUM ( Table[Total] ), ALLEXCEPT ( Table, Table[Key] ) )

         

        I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

        Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    You can add a calculated column to your calculated table with this expression.

    Total =
    CALCULATE (
    SUM ( Table[Total_WCM_EUs] ),
    ALLEXCEPT ( Table, Table[ProdFacName], Table[Year], Table[Department] )
    )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion
    sprakash1192
    Hopefully one of the suggested formulas has helped you, but I'm just curios why you need the summarized table and have chosen to do this as a calculated table. Depending on the ultimate end goal, this could be done using MEASURES and matrix/table visual instead. If you're looking for some data model efficiencies, let us know your ultimate goal.