Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
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:
Dept | Jan | Feb | Mar | Apr | May | Jun |
10011 | 1 | 1 | 1 | 0.8 | 1 | 1 |
10011 | 1 | 1 | 1 | 1 | 1 | 1 |
10013 | 0.5 | 1 | 0.7 | 0.5 | 1 | 1 |
10012 | 1 | 1 | 1 | 1 | 1 | 1 |
10012 | 1 | 1 | 1 | 1 | 1 | 1 |
10011 | 1 | 1 | 1 | 1 | 1 | 0.5 |
Required output:
Dept | Jan | Feb | Mar | Apr | May | Jun |
10011 | 3 | 3 | 3 | 2.8 | 3 | 2.5 |
10012 | 2 | 2 | 2 | 2 | 2 | 2 |
10013 | 0.5 | 1 | 0.7 | 0.5 | 1 | 1 |
Any help would be greatly appreciated.
Thanks
Solved! Go to Solution.
NewStep=Table.Group(PreviousStepName,"Dept",List.Transform(List.Skip(Table.ColumnNames(PreviousStepName)),(x)=>{x,each List.Sum(Table.Column(_,x))}))
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.
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.
NewStep=Table.Group(PreviousStepName,"Dept",List.Transform(List.Skip(Table.ColumnNames(PreviousStepName)),(x)=>{x,each List.Sum(Table.Column(_,x))}))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.