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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mstarr13
Employee
Employee

Desafío dinámico de generación de columnas

Así que necesito construir una mesa sobre la marcha. Primero la estructura, luego voy a llenarla. En la estructura, sólo quiero insertar una columna para cada año de 2007 a 2058. Estaba intentando hacer esto con un List.Generate bucle usando el siguiente código:

Dejar
test_procurements_table de la fuente de la fuente,[Nombre"test_procurements", "Firma"tabla"],[Datos],

crear una tabla con años para columnas
YearTable - #table ("Nación",o,o),

NationAircraftCountYears ? List.Generate(
()-> [curYr-2007],
cada [curYr]<2058,
cada [curYr-[curYr]+1],
cada YearTable - Table.AddColumn(YearTable,[curYr]))
En
YearTable

probado algunas variantes, pero en el mejor de los casos obtengo la tabla de columnas saingle con "Nation" como la única columna en lugar de una tabla vacía con la columna de nación más una columna para cada valor de 2007 a 2058.

5 REPLIES 5
amitchandak
Super User
Super User

@mstarr13 ,

puede transponer ayuda

https://docs.microsoft.com/en-us/powerquery-m/table-transpose

Ejemplo
Table.Transpose(Table.FromRecords('[Nombre' "Nombre completo", Valor ''Fred'],'Nombre'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

parry2k
Super User
Super User

@mstarr13 por lo que desea 52 columnas(2007 - 2058)?? Es un mal diseño ti, no estoy seguro de cómo estás planeando usar estas columnas.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

sí, en este caso 52 columnas. Una vez que se construye esa tabla, se va a rellenar con valores que he generado mediante la notificación de número de Procurment por cada uno de esos años que he resumido en otra tabla mediante la agrupación en un identificador de org. Así que obtengo un desglose de los números de adquisición por Org para cada uno de esos años.

Imagine que tiene una tabla:

Org, Año,

Un 2007 12

Un 2007 14

A 2008 8

A 2009 6

B 2007 10

B 2007 9

B 2009 5

y así sucesivamente para 24 organizaciones, durante años que abarcan 2007-2028. Quieren ver en su informe

Org 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019

A 26 8 6 6 0 0 0 0 0 0 0 0

B 19 0 5 0 0 0 0 0 0 0 0

y así sucesivamente. Estos datos salen de una fuente de OData D365, la estructura entrante no se puede cambiar y no admite los tipos de métricas que desean, por lo que estoy intentando construir la estructura sobre la marcha para informar.

@mstarr13 en función de sus comentarios, debería usar year en filas que no están en columnas y luego puede visualizar la forma que desee. Este es un mejor diseño en lugar de tener años en columnas.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@mstarr13 basa en su tabla de datos de ejemplo, es perfecto, utilice matrix visual, ponga org en filas, años en columnas y . adquirió en valor y obtendrá lo que está buscando.

Apreciaría Kudos 🙂 si mi solución me ayudara.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.