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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rohitthb
Frequent Visitor

How to do aggregation in column values instead of rows

Hi,

 

I am a bit novice in power BI and just starting up.

 

What I basically want to know is if summation/count etc can be put in first column rather than adding them in rows?

This is how it looks in excel. 

 

Capture.PNG

 

Can we create such looking matrix or table in power BI?

 

Thanks

Rohit

1 ACCEPTED SOLUTION

Hi @rohitthb,

 

Looking at your data I believe that the best way to do this is to unpivot the information you have and then do the matrix, this because if you add the columns you want to calculate to the matrix visual you will get the calculations but the name will not be there, again this is based on the information you made available.

 

I the Power Query view do as follow:

- Select all the columns to be calculated

- Unpivot columns

 

This will give you a new format with:

- City

- Value

- Yearmon

- Attribute - As the name of the columns # bills, # Customers,...

 

Then just add YearMon as columns, Value as value and attibute as Columns. You can then filter the attibute in the matrix visual if you don't want everything to show in the table or add a slicer. check the print screnns below.

 

Matrix.png

 

Regards,

 

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

7 REPLIES 7
MFelix
Super User
Super User

Hi @rohitthb,

 

If you select the Matrix visuals you can add the rows/columns as you need.

 

Regrads,

 

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix,

 

Thanks for your reply. I am not able to figure out the option which enables me to get aggregation in the column.

In excel this options come by dragging summation from column into rows in pivot.

 

I am clueless how to do this in power BI. If you could guide me it will be helpful.

 

Thanks

Rohit

If you select the matrix you can add the colunns and the rows to the visual and in the values it does the summary so.if you put the accounts on columns and the values in the values you will get the same format, depending in the way you have the table set-up.

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @rohitthb - do you want the final table to look like the picture in your original post?  If so, where is the value 201601 coming from?  Is 201601 the name of a column in your table, or is that the value in a column ?  Some more information on where you are starting and exactly what you are trying to achieve would be helpful to troubleshoot.

hi @dedelman_clng,

 

Thanks for your reply. 

This is the sample data structure

 

Cityyearmon# of Bills# of CustomersRevenue# of Repeat CustomersRevenue from Repeat Customers
A201601214717355250741054400297
A201602267821147840001326564902
A201603252020095039341169210811
A20160420001844680402950423141
A2016052000196878296911142299003
B2016012592207910141881135544405
B2016022605206010680801020779486
B20160323521898927795881628698

 

I have City in filter and I want to show month on month sum of bills, customers, revenue etc calculated. I want 201601, 201602 to come in separate columns like in my earlier post.

 

Looking forward to your reply.

 

Thanks

Rohit

Hi @rohitthb,

 

Looking at your data I believe that the best way to do this is to unpivot the information you have and then do the matrix, this because if you add the columns you want to calculate to the matrix visual you will get the calculations but the name will not be there, again this is based on the information you made available.

 

I the Power Query view do as follow:

- Select all the columns to be calculated

- Unpivot columns

 

This will give you a new format with:

- City

- Value

- Yearmon

- Attribute - As the name of the columns # bills, # Customers,...

 

Then just add YearMon as columns, Value as value and attibute as Columns. You can then filter the attibute in the matrix visual if you don't want everything to show in the table or add a slicer. check the print screnns below.

 

Matrix.png

 

Regards,

 

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix,

 

First of all sorry for late response. I was out sick.

This is exactly what I was looking for and was not able to figure out. Super thanks for your answer.

 

Thanks

Rohit

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.