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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Gopal2704
Frequent Visitor

Power Query Pivot stuck

Hi Everyone !
I have been trying to pivot the below data by wrt to Account_L2 and Values.
There are around 5 million such rows
But it is taking a hell lot of time and finally crashing my power BI.

The source is Dataflow.
Please help

MonthYearZONE 1ZONE 2CLUSTER 1CLUSTER 2CLUSTER 3CLUSTER 4COUNTRYFDT ClusterNBM CountriesFranchiseFranchise#2Division#1Division#2PRODUCT FAMILYPRODUCTMAIN PRODUCTEXT - SEGMENTEXT - ASSET TYPEEXT - PRODUCT FAMILY NEWINT - SEGMENTINT - ASSET TYPEINT - PRODUCT FAMILY NEWMARKET#1MARKET#2Other information #1Other information #2Account_L2INT - FDT SEGMENTRatesATT_DIVATT_EnActiviteMC CodeAccount CodeProduct CodeExtracted RatesAttributeValue
Dec2021GENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGROSS MARGIN GENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINES713000
Dec2021GENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGROSS MARGIN GENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINES-713000
Dec2021GENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGROSS MARGIN GENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINES0
Dec2021GENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGROSS MARGIN GENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINESGENERAL MEDICINES0
1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Gopal2704 ,

 

Pivot/Unpivot are 'whole-table' operations i.e. Power Query must load the ENTIRE table into memory in order to perform the transformation.

 

For such large tables, you have a few options:

-1- Don't perform the pivot at all and see if it's possible to use the data in its native state e.g. by using matrix visuals etc.

-2- Perform the pivot operation at source e.g. write a view on the server that pivots the data before being brought in to Dataflow/Power Query.

-3- Use the original source (SQL Server etc.) as your query source (instead of a Dataflow) and utilise query folding to perform the operation at source.

-4- Break up/filter your table into much smaller pieces before performing the pivot/unpivot.

-5- Invest in RAM to go into your gateways/desktop/laptop, cranking them all up to 48GB-64GB+.

 

You may also find performance improvements by doing the pivot in DAX, although this will likely also be highly dependent on machine RAM availability as well.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @Gopal2704 ,

 

Pivot/Unpivot are 'whole-table' operations i.e. Power Query must load the ENTIRE table into memory in order to perform the transformation.

 

For such large tables, you have a few options:

-1- Don't perform the pivot at all and see if it's possible to use the data in its native state e.g. by using matrix visuals etc.

-2- Perform the pivot operation at source e.g. write a view on the server that pivots the data before being brought in to Dataflow/Power Query.

-3- Use the original source (SQL Server etc.) as your query source (instead of a Dataflow) and utilise query folding to perform the operation at source.

-4- Break up/filter your table into much smaller pieces before performing the pivot/unpivot.

-5- Invest in RAM to go into your gateways/desktop/laptop, cranking them all up to 48GB-64GB+.

 

You may also find performance improvements by doing the pivot in DAX, although this will likely also be highly dependent on machine RAM availability as well.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Thank you for providing a detailed solution Pete !!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors