Forum Discussion

EaglesTony's avatar
EaglesTony
Post Prodigy
2 years ago
Solved

How do I get a grand total in PowerQuery M

Hi,

 

  I have this table

 

ID      TotalNumberofItems

1       5

2       2

3       4

 

What I need is a grand total, something like

 

ID    TotalNumberofItems    Grand Total

1      5                                   11

2      2                                   11

3      4                                   11

 

Or is there a way to have a "dummy" row at the end to total these, as such:

 

ID                           TotalNumberofItems  

1                             5                                   

2                             2                                   

3                             4   

DummyRow          11                                   

 

 

  • Duplicate your table > Highlight the column you want to get the grand total from > Transform > Statistics > Sum

    Rename 'Table (2)' into something more useful like 'Grand_Total'

    Go back to original table > Add Column > Custom Column > enter in whatever you just named the grand total

     

    All done!

     

     

2 Replies

  • Syk's avatar
    Syk
    Resident Rockstar

    Duplicate your table > Highlight the column you want to get the grand total from > Transform > Statistics > Sum

    Rename 'Table (2)' into something more useful like 'Grand_Total'

    Go back to original table > Add Column > Custom Column > enter in whatever you just named the grand total

     

    All done!

     

     

    • EaglesTony's avatar
      EaglesTony
      Post Prodigy

      Now thinking is there an easier way, my thinking is if I duplicate the table and it is pulling data when refreshing then it is refreshing 2 tables with the same data instead of 1 table..

       

      Is Dax an option here ?