Forum

Display total sum f...
 
Notifications
Clear all

Display total sum for each Pivoted column in Power Query

6 Posts
2 Users
0 Reactions
322 Views
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi,

I got a similar case wanted to sum up Month for each column and display it,  understand that UI is not able to achieve it and need M Code,   had tried the recommendation in the following blog but it doesn't work for me.

is there any simplify way ?

 

Thank you

 

https://stackoverflow.com/questions/55868585/how-to-add-totals-row-to-excel-power-query

 
Posted : 03/12/2019 9:53 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Chris,

You can turn on the Total row in the Excel Table (as opposed to adding it in Power Query)? Table tab > check the box for the 'Total Row'. You'll need to insert the totals for the other columns as it will only automatically add it for the last column.

Mynda

 
Posted : 04/12/2019 2:43 am
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi Mynda,  so you are suggesting using excel table properties instead of M Code in PQ,   However when I click refresh all the total formulae are wiped off

attached the source csv file and the PowerQuery before refreshing

 

Thank you !

 
Posted : 04/12/2019 10:48 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Chris,

I can't reproduce the problem. It doesn't wipe the total row out for me. If I filter the GrpBy_Card_Company query to exclude, say Visa, then Close & Load, the table reduces by one line and the total row moves up accordingly. If I then edit the query again to put Visa back in, the table increases by one row and the total row moves down by one.

Refresh All also doesn't cause any issues.

If you can't get it to work I would suggest creating a PivotTable for the totals. Power Query isn't the place for summarising data. You should be using Power Query to clean your raw data ready for summarising with tools like PivotTables and formulas.

Mynda

 
Posted : 05/12/2019 6:28 am
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi Mynda,

Found out the reasons,  need to "check" the preserve column sort/filter/layout under table > External data properties,  by default it is uncheck,  probably you are using office 365 don't have such problem

cheers and thanks !

 
Posted : 10/12/2019 4:54 am
(@mynda)
Posts: 4761
Member Admin
 

Ah, yes I am using Office 365. Glad you figured out the problem and thanks for sharing.

 
Posted : 10/12/2019 8:13 am
Share: