Go Summarize

PIVOT ERRORS in Power BI I How to FIX IT

How to Power BI2021-02-21
pivoting power bi#power bi pivoting#pivot error power bi#power query#m power bi#pivot transformation#pivot power bi#power bi pivot#power query help#power query error#error power query#pivot error in power query#power bi m#learn m#m in power bi#pivoting in power bi#resolve pivot error#power bi#power bi tutorials for beginners#power bi desktop
12K views|3 years ago
💫 Short Summary

This tutorial in the 'How to Power BI' series by Bosé will help you understand the reasons why a pivot operation in Power BI may fail and how to overcome those issues using Power Query transformations. Bosé demonstrates two methods to solve the problem and provides a comprehensive overview of the process with practical examples.

✨ Highlights
📊 Transcript
This section demonstrates how to pivot a table in Power BI and the potential issue that can arise if the table is not set up correctly.
00:00
In an ideal case scenario, the data set has three columns: employee names, attributes, and corresponding values.
Pivoting the table transforms rows into columns based on the attribute column.
A small change to the data set, removing the employee names column, causes the pivot operation to fail due to too many elements in the enumeration.
A third column, 'Entity', is added to map the attributes to the employees, and a conditional column is used to display the employee names.
02:29
The 'Entity' column is added by undoing the last step and then adding a conditional column for the employee names.
Null values in the employee names column are filled down.
With the three required columns (Attribute, Value, Entity) in place, the pivot operation can be successfully executed.
Another approach to solve the pivot issue is demonstrated by adding an index number for each entity using the 'Group By' function.
04:46
Nested tables are created for each attribute with its corresponding values for different entities.
An index column is added within each table to map the attributes to the entities.
The index column is expanded, and the value in the index is brought over.
The pivot operation is performed again, and the attribute column is selected to complete the process.
The process of combining multiple values for the same entity using the 'Group By' function and resolving errors when taking the sum of text values.
07:15
Grouping by employee and attribute to ensure each employee has only one instance of each attribute.
Modifying the formula by transforming list.sum into text.combine and adding a comma between values.
Changing the data type to text to resolve errors and successfully pivoting the data.
A potential issue when pivoting data is having no values in the attribute column, which can be resolved by removing empty cells before pivoting.
09:31
An error is shown when trying to pivot the data with a null value in the attribute column.
The issue can be fixed by removing empty cells in the attribute column before pivoting.
💫 FAQs about This YouTube Video

1. What is the process for pivoting a table in Power BI?

To pivot a table in Power BI, you need to select the column you want to pivot, go to the Transform tab, choose the Pivot Column option, and then select the value column. Ensure that you do not aggregate the values, especially if you want to show the actual values without any aggregation.

2. How can the 'too many elements in the enumeration' error be fixed when pivoting a table in Power BI?

The 'too many elements in the enumeration' error when pivoting a table in Power BI can be fixed by ensuring that there is a separate column for the attribute names to map the different attributes to an entity. This can be achieved by adding a conditional column for the entity names and filling any null values.

3. What are the two approaches to solve the pivot issue in Power BI?

There are two approaches to solve the pivot issue in Power BI. The first approach involves adding a third column for the entity names and the attributes to map the attributes to the entities. The second approach uses an index number for the entity within each table to map the attributes to the entities.

4. How can the 'too many elements in the enumeration' error be fixed when there are duplicates in the attribute column for the same entity in Power BI?

To fix the 'too many elements in the enumeration' error when there are duplicates in the attribute column for the same entity in Power BI, the data can be grouped by the entity and attribute, and the values can be combined using a suitable operation such as sum or text combine.

5. What potential issue should be considered when pivoting data in Power BI?

One potential issue to consider when pivoting data in Power BI is having empty or null values in the attribute column, which can cause errors during the pivot operation. Ensuring the data is clean and does not contain any empty or null values in the attribute column can help avoid this issue.