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
varutvu
Regular Visitor

Utilice la segmentación para seleccionar la columna que desea sumar

Hola a todos,

Tengo una mesa con 30 columnas, digamos C1... C30. Y necesita crear un panel donde un usuario pueda usar la segmentación de datos para elegir qué columna sumar y generarla en un gráfico. Por ejemplo, cuando el usuario selecciona C7 en la segmentación de datos, el gráfico traza una suma de columna [C7].

Sé que una manera de lograr esto es crear 30 medidas y usar la función SWITCH(). Pero, ¿hay alguna manera de crear una sola medida y un nombre de columna de referencia con una variable?

¡Gracias!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Si puede utilizar el editor de consultas, seleccione C1... C30 y haga clic en columnas despivot. Eso le permitirá hacerlo fácilmente con un solo cálculo.

Karlos_0-1597574313986.png

Karlos_1-1597574327172.png

También debería poder utilizar la función UNION en DAX, consulte a continuación un ejemplo

https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax

View solution in original post

2 REPLIES 2
AllisonKennedy
Super User
Super User

@varutvu
Estoy de acuerdo con @Karlos
Sin saber más acerca de qué datos hay en las columnas 1 - 30, también creo que esto suena como datos que podrían ser mejor sin votar.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Si puede utilizar el editor de consultas, seleccione C1... C30 y haga clic en columnas despivot. Eso le permitirá hacerlo fácilmente con un solo cálculo.

Karlos_0-1597574313986.png

Karlos_1-1597574327172.png

También debería poder utilizar la función UNION en DAX, consulte a continuación un ejemplo

https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax

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.