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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
sabeensp
Helper IV
Helper IV

Nombre de columna dinámico

Hola

Tengo una tabla como se muestra a continuación. Tengo que trazar los datos en Grid, pero la columna debe ser el año real. Cada año, año se incrementará como el año actual + 1, + 2, y así sucesivamente. Así que no puedo simplemente cambiar el encabezado Colum. Los nombres de campo de tabla no cambiarán en la base de datos. ¿Hay alguna manera en M-Query de cambiar la columna nae como YEAR(Now()), YEAR(Now()) +1 y así sucesivamente. Por favor, consejos cómo lograr esto?

Yr.png

7 REPLIES 7
parry2k
Super User
Super User

@selpaqm el nombre de la columna siempre se parece a yr1 yr2 yr3... si sí, entonces puedo conseguirte la solución que será dinámica



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.

@parry2k Sí, el nombre de la columna siempre será el mismo. Yr1, Yr2, y así sucesivamente

@sabeensp ver adjunta, mire la tabla denominada Tabla en consulta de alimentación y tome el año actual como base y, a continuación, reemplaza los nombres de columna en consecuencia. Se puede mejorar aún más, pero creo que es un buen comienzo.



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.

Me habría acercado de la misma manera @parry2k , con Table.ColumnNames y List.Zip. Un pequeño cambio para reducir el número de pasos sería usar esta fórmula para hacer la lista de Años para los nombres de columna con esto:

•List.Transform(-1..3', cada Number.ToText(currentYear + _))

saludos

palmadita





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat acordado, suponiendo que los números de columna están en el mismo orden y esa es la razón por la que decidí no seguir ese camino, pero gracias por señalarlo.



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.

selpaqm
Helper V
Helper V

Hola

intentó cambiarlo de la sección Transformar datos.

En la sección Inicio, haga clic en Transformar datos y, a continuación, elija la tabla relacionada en la sección de consultas. cambiar los encabezados de columna de la tabla con doble clic en ella o simplemente haga clic con el botón derecho y cámbiele el nombre. esto se agregará a la sección Pasos aplicados e incluso actualizará los datos, los reemplazará por sí mismo.

@selpaqm ¿Cómo funcionaría el próximo año, cuando el año que viene cambiará?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors