Traducir el blog
Power Query - multiple slicers (4/4)
This is the fourth solution with Power Query to transform a poorly designed table into a pivot table but with multiple repeating rows.
In the following dynamic image you can see the 9 steps applied to transform the table.
Fourth solution
This fourth and last solution doesn't use a generic function, as in the previous solutions, it only uses these 9 steps applied with Power Query, which can be seen in the Advanced Editor:
Below I explain each of these applied steps:
1) Source = Excel.CurrentWorkbook(){[Name="TableDetails"]}[Content]
TableDetails is the original table with the Details column, with the details of the 3 data types listed in the Type column: Locations, Ages & Skills. The rest of columns are names of people with a Y o y to indicate that they are part of a specific detail of one of the data types. For example, Mary has been to two different locations: London & Joburg, which should be considered when pivot the table in the step 7).
2) #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Type", "Details"}, "Name", "Value"),
In this step, the 2 columns on the left (Type & Details) are selected to unpivot the columns with Names, creating a normalized table with 2 additional columns: Name & Value, inserting a row for each pair of values of those columns. Null values don't create new rows. The Table.UnpivotColumns function forces the selected columns to be unpivoted, so the Table.UnpivotOtherColumns function is used, which is independent of the number of columns to be unpivoted, so it is not necessary to select each column with a Name who, a priori, it is not known.
3) #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Value"}),
The Value column is not relevant so it is removed. Notice that it contains both the uppercase Y letter and the lowercase y letter, to indicate that a type detail exists for a given name.
4) #"Group Clust Index" = Table.Group( #"Removed Columns",
List.RemoveItems(Table.ColumnNames(#"Removed Columns"),{"Details"}),
{"ColOfTables",each Table.AddIndexColumn(_,"idx")}),
This step is very important because it creates a column composed of "ColOfTables" tables, one for each pair of Type & Name values, with as many rows as there are Details records for each pair of Type & Name values, adding a consecutive index column " idx" to distinguish each row in that table. The 18 rows from above step 3) have been converted to 15 rows in which the Type & Name value pairs are not duplicated.
5) #"Expanded ColOfTables" = Table.ExpandTableColumn(#"Group Clust Index", "ColOfTables", {"Details", "idx"}, {"Details", "idx"}),
This step expands the values of the tables of the column "ColdOfTables" in two columns: Details & idx (index of each table), so that the 15 rows become 18 rows in this case, being 3 details with the same pair of Type & Name values, and their indices are 0 and 1 respectively.
6) #"Sorted Rows" = Table.Sort(#"Expanded ColOfTables",{{"idx", Order.Ascending}}),
The trick to correctly pivot this table in the next step 7) is that the index column "idx" is in ascending order.
7) #"Pivoted Column" = Table.Pivot(#"Sorted Rows", List.Distinct(#"Sorted Rows"[Type]), "Type", "Details"),
This step pivots the table by creating 3 Type columns: Ages, Skills & Locations, with their Details values for each Name. It is observed that it is not an ordinary pivot table, as there are duplications in the Name column, discriminated by the index "idx" column.
8) #"Removed Index" = Table.RemoveColumns(#"Pivoted Column",{"idx"}),
Right now you can remove the index "idx" column, as it has already played its role pivoting the table with repeated names into the several rows.
9) #"Filled Down" = Table.FillDown(#"Removed Index",{"Locations", "Ages", "Skills"})
This last step fills in the nulls with the values on the above row that correspond to the same Name.
This fourth solution allows you to see the result of each step applied in the Power Query Editor, which is not elementary with a generic function, since it applies all the steps without being able to see what each step does with the tables tranformation. This solution also makes it easier to copy these steps in M language code from the Power Query Advanced Editor to paste it into another Excel workbook or even into Power BI.
These 9 steps are a good example that Power Query is an excellent ETL tool to Extract, Transform & Load. An additional loading step is done just before closing the Power Query Editor, choosing to load the transformed table as a normal Excel table.
It is possible to insert in this table 3 slicers, one for Locations, another for Ages and another for Skills, as it was intended to achieve in the statement of the problem that was raised in this forum:
MrExcel.com - multiple slicers
I have a table of data with locations, ages, and skills in the left hand column. Can a slicer be set up for each data type? ie one for the locations, one for the ages, and one for the skills.
Fourth solution download
- From this link to Microsoft OneDrive:
- From this link to Sites Google Drive:
This post completes the 4 solutions proposed to solve this problem, which I hope will help my readers to start and experiment with Power Query, with all its potential as an ETL tool, which allows solving complex problems without the need to program avanced Excel formulas and/or macros VBA.
Mi lista de blogs
-
FREE 4 Hours Complete Excel Course - FREE 4 Hours Complete Excel Course Here is a FREE, complete end-to-end Excel course to help you learn all the key and essential aspects of Microsoft Exce...Hace 7 horas
-
Jugando al Rabino en Excel - Parte 7 - 🔝*To translate this blog post to your language, select it in the top left Google box. * Parte 7 de un juego del Rabino Esta es la séptima parte de ...Hace 2 días
-
CREAR APP PARA LEER CÓDIGOS QR Y GUARDAR FECHA DE ESCANEO - Hola a todos! Hace casi un mes publicaba cómo podíamos hacer una App que fuese capaz de leer los códigos de barras: CREAR APP PARA … La entrada CREAR AP...Hace 4 días
-
Calendario 2025 Excel: Imprime, Personaliza y Organiza tu Año - Calendario 2025 Excel ya puedes descargar la plantilla para imprimir gratis. En formato hoja de cálculo Excel. Escribe a hola@excelcontabilidadytic.com y...Hace 4 días
-
Sumas de potencias consecutivas - Existen fórmulas para sumar las primeras potencias de números naturales. Son populares las de la suma de potencias con los primeros exponentes. En esta c...Hace 1 semana
-
Secretos de Excel que ni los Expertos Dominan – PARTE 1 - Hace poco, en un Live con mi amigo Gerson Pineda, caímos en la cuenta de algo interesante: hay detalles en […] The post Secretos de Excel que ni los Expe...Hace 1 semana
-
Scipy update and Linalgfuncs speed check - I have updated the Scipy code to remove repeated loading of the Numpy code, and to fix a number of other warnings from the pyxll log file. I have also upda...Hace 1 semana
-
Debra’s Excel News–December 2024 - Fix a column header problem, QAT tips, and more, in this month’s Excel news. Visit my Excel website for more tips, tutorials and videos, and check the inde...Hace 2 semanas
-
5 Ways To Show All Notes in Microsoft Excel - Are you wondering how to show all notes in Excel? To unlock all the secrets of Microsoft Excel worksheet notes, keep reading! Managing notes in Excel can f...Hace 5 semanas
-
Color, Conditions, and Copilot: How to save time using conditional formatting with Copilot in Excel - Hi everyone, this is part 11 in a series of posts to show you some of the things that are possible to do with Copilot in Excel. *What is conditional f...Hace 1 mes
-
4 ejemplos de utilización de validación de datos con fórmulas - Ya sabes que la herramienta de Validación de datos es de gran utilidad para controlar y restringir la introducción de datos y así, asegurarte de…Hace 3 meses
-
Trucos de Excel: Referencias Relativas, Absolutas y Mixtas Explicadas ✨ [VIDEO] - ¡Hola a todos! Hoy hablaremos sobre un tema muy importante para quienes usan Excel: los tipos de referencia. Las referencias son fundamentales al momento d...Hace 3 meses
-
How To Predict Bearing Life With Excel - When you work in mechanical engineering, understanding the reliability and performance of bearings under various conditions is crucial. Bearings are the co...Hace 3 meses
-
-
Minutos de juego y puntos. El Espanyol, sus finales de partido y mis enfados - Pienso que el Espanyol este 2024 se está dejando muchos puntos al final de los partidos. Cuando el ... Leer más » The post Minutos de juego y puntos. El ...Hace 8 meses
-
TikTok’s search evolution - 2 in 5 Americans use TikTok as a search engine. Nearly 1 in 10 Gen Zers are more likely to rely on TikTok than Google as a search engine. More than half of...Hace 9 meses
-
MASTERCLASS Gratis – Gráfica de Gestión Proyectos en #EXCEL. - Aprende a crear un Gráfico de CURVA S, ideal para GESTIÓN DE PROYECTOS, porque te permite identificar como esta tu proyecto tanto en COSTOS como en TIEMP...Hace 10 meses
-
Demos cursos de Excel 2007, 2010, 2013, 2016, 365 - Puedes consultar las demostraciones de los siguientes capítulos de los cursos Excel. Demo cursos ExcelHace 11 meses
-
Unblocking and Enabling Macros - When Windows detects that a file has come from a computer other than the one you're using, it marks the file as coming from the web, and blocks the file....Hace 1 año
-
Office Scripts: Trabajando con Tablas - [image: Office Scripts: Trabajando con Tablas] Me he dado cuenta que últimamente solo escribo de lenguaje M (es mi pequeño vicio)... pero hay que liberar l...Hace 1 año
-
Hello world! - [image: Hello world!] Welcome to WordPress. This is your first post. Edit or delete it, then start writing!Hace 2 años
-
La importancia de saber mecanografía en 2022 - [image: Resultado de imagen de mecanografía viñeta escribiendo a máquina] Según la RAE, la mecanografía es el arte de escribir a máquina. Hace unos cuantos...Hace 2 años
-
London Excel Meetup Workbooks - The workbooks used in my presentation on “Analytical and Interactive Dashboards in Excel” at the London Excel Meetup, September 3, 2020Hace 4 años
-
Cálculo de jornada que termina al día siguiente (Power Query) y despedida - [image: Cálculo de jornada que termina al día siguiente (Power Query) y despedida] Este blog se ha ocupado de cálculos de tiempo con bastante intensidad, c...Hace 4 años
-
Agenda Perpetua Excel Calendario Perpetuo - Saludos a los ingenieros y a todos los que forman parte de nuestra comunidad de planillas Excel para ingeniería civil, ya se vienen las fiestas navideñas y...Hace 5 años
-
International Keyboard Shortcut Day 2019 - The first Wednesday of every November is International Keyboard Shortcut Day. This Wednesday, people from all over the world will become far less efficient...Hace 5 años
-
Welcome, Prashanth! - Last March, I shared that we were starting to look for a new CEO for Stack Overflow. We were looking for that rare combination of someone who… Read more "W...Hace 5 años
-
Visualize parts and whole - combine clustered column and stacked column charts - *Inga: Disa what?* *Igor: -ppeared.* by The FrankensTeam ------------------------------ Really it was 3 years ago we posted our last article? *Freddy: Th...Hace 5 años
-
Salvador Sostres, analfabeto profesional - Los nuevos tiempos traen nuevas profesiones. Internet, además, ha revolucionado el mundo del periodismo y la palabra escrita. Adaptarse o morir, ese es el ...Hace 6 años
-
Planificación de compras - Realizar una lista con los productos que necesitamos y que formarán parte de nuestra cesta de la compra nos ayuda a *encontrar la combinación de bienes p...Hace 12 años
-
-
-
-
-
-
-
-
-
No Response to "Power Query - multiple slicers (4/4)"
Leave A Reply
Indícame las erratas que encuentres y qué es lo que te gustaría ver en los próximos artículos.