Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Plump_Lil_Monk
Frequent Visitor

Summarise multiple columns based on one column.

Hi,

I have a problem where I have a table with a department column and 12 other columns with each month of the year.

 

The department column has multiple rows and the subsequent month columns have values of no more than 1 in each cell.

 

I need to be able to sum the table by department so that each department shows up once, in the department column, while also adding up the values for each month for that department.

 

Sample table:

DeptJanFebMarAprMayJun
100111110.811
10011111111
100130.510.70.511
10012111111
10012111111
10011111110.5

 

Required output:

DeptJanFebMarAprMayJun
100113332.832.5
10012222222
100130.510.70.511

 

Any help would be greatly appreciated. 

 

Thanks

 

2 ACCEPTED SOLUTIONS
wdx223_Daniel
Super User
Super User

NewStep=Table.Group(PreviousStepName,"Dept",List.Transform(List.Skip(Table.ColumnNames(PreviousStepName)),(x)=>{x,each List.Sum(Table.Column(_,x))}))

View solution in original post

lbendlin
Super User
Super User

or, you know, unpivot your data to bring it into usable form, and then let the Power BI matrix visual do all the work for you.

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

or, you know, unpivot your data to bring it into usable form, and then let the Power BI matrix visual do all the work for you.

wdx223_Daniel
Super User
Super User

NewStep=Table.Group(PreviousStepName,"Dept",List.Transform(List.Skip(Table.ColumnNames(PreviousStepName)),(x)=>{x,each List.Sum(Table.Column(_,x))}))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors