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
-
Análisis de Datos por Fechas y Horas en Excel - Cuando se trata de analizar datos, es común encontrarse con solicitudes que van más allá de simplemente agrupar por fecha. […] The post Análisis de Datos...Hace 2 días
-
Why Power Query Is the Excel Feature Engineers Can’t Ignore - If you find yourself buried under heaps of data with Excel as your go-to tool, then buckle up because we’re heading into the world of […]Hace 3 días
-
PLEASE UPDATE THE RSS FEED - The RSS feed URL you're currently using https://follow.it/excelunusual will stop working shortly. Please add /rss at the and of the URL, so that the URL ...Hace 3 días
-
PLEASE UPDATE THE RSS FEED - The RSS feed URL you're currently using https://follow.it/excel-foro-ejercicios-ejemplos-soluciones-dudas will stop working shortly. Please add /rss at t...Hace 3 días
-
PLEASE UPDATE THE RSS FEED - [image: PLEASE UPDATE THE RSS FEED] The RSS feed URL you're currently using https://follow.it/jldexcelsp will stop working shortly. Please add /rss at the...Hace 3 días
-
Excel Dependent Drop Down Lists – Block Changes - One of my favourite Excel features is a data validation drop down list. In just a couple of minutes, you can make a list of items, then make that list appe...Hace 3 días
-
Hipotenusas de cuaternas pitagóricas - Una cuaterna pitagórica es la expresión algebraica del teorema de Pitágoras en tres dimensiones, es decir, un conjunto de cuatro números enteros positivo...Hace 5 días
-
Excel Power Query: Obtener y transformar - Iconos más importantes de Obtener y transformar de Excel 2016: Obtener y transformar (Power Query) de Yolanda Cuesta Altieri Excel Power Query: Obtener y...Hace 5 días
-
CONTROLAR LOS TIEMPOS EN NUESTRAS APLICACIONES DE POWER APPS CON EL TEMPORIZADOR - Hola a todos! Cuanto realizamos programaciones es normal el uso de funciones para pausar la ejecución del código un determinado tiempo o para programarlo...Hace 1 semana
-
Let, Lambda, and py_Eval - I have covered the new Excel Let and Lambda functions before at: Two New Functions; Let and Lambda Eval and Let examples Lambda and VBA The Lambda function...Hace 1 semana
-
Conversor PGN de ajedrez mejorado - 🔝*Select the language of this blog post in the Google box at the top left. * Esta es la *4ª versión del Conversor PGN de ajedrez* que hago, cada uno ...Hace 1 semana
-
10 Ways to Count the Number of Occurrences in Microsoft Excel - Wondering how to count the number of occurrences in Excel? You’ve reached the right resource! Keep reading. Suppose, you’ve got a tabular dataset in your w...Hace 2 semanas
-
Announcing Power BI Dashboard Contest (win $500 prizes!) - Hey there, I have a SUPER exciting announcement! April is about to get a whole lot sweeter with our Power BI Dashboard Contest! Your mission, should you ...Hace 2 semanas
-
What's New in Excel (March 2024) - Welcome to our March 2024 update. This month, export to CSV and show details in PivotTables are now available in Excel for the web. Also, creating Power...Hace 3 semanas
-
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 3 semanas
-
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 5 semanas
-
Aprende cómo usar la función #Filtrar con rangos de fechas SIN macros 📋 [VIDEO] - ¿Alguna vez te has preguntado cómo puedes filtrar tus datos por fechas específicas en Excel de manera rápida y eficiente? En este video, voy a enseñarte pa...Hace 1 mes
-
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 2 meses
-
Interés compuesto con Excel - En la imagen, se presenta un esquema de las distintas funciones Excel para calcular el valor del dinero en el tiempo mediante la capitalización compuesta...Hace 2 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 3 meses
-
El sistema operativo no está configurado para ejecutar esta aplicacion. - Si esta semana habéis recibido el mensaje "El sistema operativo no está configurado para ejecutar esta aplicacion" cuanto intentásteis abrir alguna aplic...Hace 7 meses
-
Atajos esenciales de Excel que todo profesional debe conocer - Manejar Excel con destreza puede ser el superpoder que no sabías que necesitabas. Agiliza tus tareas diarias y sorprende a tus colegas con estos atajos c...Hace 8 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
-
-
Navigating Outlook Favorites - I have these four favorites defined in Outlook: From the inbox, I could hit Shift+F6 to get into the Favorites area but sometimes I would end up in no man’...Hace 1 año
-
Progress on the Block Protocol - Since the 1990s, the web has been a publishing place for human-readable documents. Documents published on the web are in HTML. HTML has a little bit of… Re...Hace 1 año
-
Decálogo para realizar Trabajos de Fin de Grado (TFGs) y de Fin de Máster (TFMs) - 1.- Tanto TFGs como TFMs son un requisito para graduarse a la vez que una oportunidad para aprender. Así, el tiempo que se le dedica es muy variable. De...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 3 años
-
Dimensiones-Propiedades de perfiles de acero (IMCA) - Saludos compañeros, en esta oportunidad compartimos esta Planilla Excel que contiene las Propiedades y dimensiones de diferentes tipos de perfiles de acero...Hace 4 años
-
-
-
-
-
-
No Response to "Power Query - multiple slicers (4/4)"
Leave A Reply
Dime si te gusta lo que lees y, si no te gusta, dime por qué. Tengo habilitada la moderación de comentarios. Tu comentario se publicará pronto.