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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
alee023
Frequent Visitor

How can I create a PivotTable with multiple rows?

I'm using Dataflow Gen2 in Fabric Data Engineering/Data Factory. Under the "Transform" tab, I see the option to "Pivot column" if I have a column selected. How can I replicate Excel's PivotTable functionality where I can select multiple columns to put under "Rows"? See example below where I have Environment and Severity as Rows

 

For example, if I have the data below:

EnvironmentAccountSeverityStatus
prod000HighFixed
prod001LowNew
nprod006MediumReopened
nprod003MediumFixed

Then I want the PivotTable to look like the below. In Excel, the selections are - Columns: Status, Rows: Environment + Severity, Values: Count of Accounts

Count of AccountsColumn Labels   
Row LabelsFixedNewReopenedGrand Total
prod1102
High1   
Low 1  
nprod1012
Medium1 1 
1 ACCEPTED SOLUTION
miguel
Community Admin
Community Admin

A Pivot Table has different layouts. Typically the "compact" view is something that goes beyond just a pivot table and goes into the visualization aspect. Power Query matches the "tabular view" layout that a pivot table can have in Excel.

 

To accomplish this, all you need to do is select the Status column and then do the Pivot transformation. In the Pivot dialog, select the advanced option and use the "Value column" as 'Account' and do a 'Count (all)' aggregation. 

miguel_0-1710207588584.png

That will yield the result that you're expecting, except that the "grand total" is something that you need to calculate yourself. We do recommend using other tools, such as pivot tables or Power BI, for analytical purposes as Power Query is primarily aimed to be a Data Preparation tool.

 

Below is the documentation on how to pivot columns in Power Query:

Pivot columns - Power Query | Microsoft Learn

 

 

View solution in original post

5 REPLIES 5
miguel
Community Admin
Community Admin

A Pivot Table has different layouts. Typically the "compact" view is something that goes beyond just a pivot table and goes into the visualization aspect. Power Query matches the "tabular view" layout that a pivot table can have in Excel.

 

To accomplish this, all you need to do is select the Status column and then do the Pivot transformation. In the Pivot dialog, select the advanced option and use the "Value column" as 'Account' and do a 'Count (all)' aggregation. 

miguel_0-1710207588584.png

That will yield the result that you're expecting, except that the "grand total" is something that you need to calculate yourself. We do recommend using other tools, such as pivot tables or Power BI, for analytical purposes as Power Query is primarily aimed to be a Data Preparation tool.

 

Below is the documentation on how to pivot columns in Power Query:

Pivot columns - Power Query | Microsoft Learn

 

 

I did some research and it turns out I can create something similar to PivotTables in PowerBI, called a Matrix Visualization. I have a dataflow set up that transforms CSV data into usable data that gets used in creating a PivotTable (or Matrix Visualization). I'm using a dataflow because I have CSVs (using the same column formats) coming in every month and would like to automate the process in a data pipeline. Since the formats of my data coming out of the dataflow are the same every month, is there a way to insert the PowerBI transformation in the data pipeline? 

For example, the pipeline, which I can trigger monthly, would look like the below. I already have the first 2 steps done.

Monthly CSV file lands in sharepoint folder -> DataFlow reads the data and transforms it into usable table -> PowerBI uses the data outputted by DataFlow and creates a Matrix Visualization.

Anonymous
Not applicable

Hi @alee023 
Thanks for using Fabric Community.
You can create a pivot table similar to excel pivot table as follows:

vnikhilanmsft_0-1709893874725.png


Here is the code:

vnikhilanmsft_2-1709894060234.png

 I have used a custom function and achieved this. If you want you can delete the Attribute column.
Hope this helps. Please let me know if you have any further questions.




Anonymous
Not applicable

Hi @alee023 
We haven’t heard from you on the last response and was just checking back to see if you query has been resolved. Please let us know if you have any further queries. Glad to help.
Thanks

Anonymous
Not applicable

Hi @alee023 

 

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others.
If you have any question relating to the current thread, please do let us know and we will try out best to help you.


Thanks.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors
Top Kudoed Authors