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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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 carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.