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.
Estos son los datos:
En el informe quiero tener el siguiente tipo de agregación. ¿Cómo lograrlo?
Solved! Go to Solution.
He votado respuestas útiles, pero ninguna de ellas ha respondido plenamente a la pregunta. Así que aquí voy a mostrar cómo hice lo que quería.
En primer lugar, Power Query:
let
Source = Csv.Document(File.Contents("C:\Temp\PBI_example10.1.csv"),[Delimiter=",", Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Name", type text}, {"Type", type text}, {"Categories", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Years", each Text.Split([Categories],",")),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Categories"}),
#"Expanded Years" = Table.ExpandListColumn(#"Removed Columns", "Years"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Years",{{"Years", Int64.Type}})
in
#"Changed Type1"
A continuación, visualización de matriz:
He votado respuestas útiles, pero ninguna de ellas ha respondido plenamente a la pregunta. Así que aquí voy a mostrar cómo hice lo que quería.
En primer lugar, Power Query:
let
Source = Csv.Document(File.Contents("C:\Temp\PBI_example10.1.csv"),[Delimiter=",", Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Name", type text}, {"Type", type text}, {"Categories", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Years", each Text.Split([Categories],",")),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Categories"}),
#"Expanded Years" = Table.ExpandListColumn(#"Removed Columns", "Years"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Years",{{"Years", Int64.Type}})
in
#"Changed Type1"
A continuación, visualización de matriz:
@Zyg_D , debe dividir el valor en filas en la consulta de energía. Consulte los pasos
https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/
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
@AllisonKennedy escribió:
Puede utilizar Columna dividida > Por delimitador.
Expanda Avanzadas y Dividir en ROWS.
Elija la columna como delimitador.
Todo esto hecho en Power Query Editor.
Una vez hecho esto, en la matriz de vista de informe o tabla dinámica coloque Categorías en columnas, Escriba filas y recuento de nombre en valores.
Gracias, Allison, por la sugerencia.
La cosa es que la columna "Categorías" se hace usando DAX. ¿Estoy pensando correctamente que ya no puedo aplicar Power Query en esta columna (ya que las manipulaciones de Power Query se realizan antes de jugar con DAX)?
@Zyg_D Sí, eso es correcto.
¿Cuál es el DAX para esta columna? Si se puede crear en DAX, normalmente puede volver a crearlo en Power Query. Proporcione la muestra más cruda de los datos y, a continuación, el resultado deseado.
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
@AllisonKennedy escribió:@Zyg_D Sí, eso es correcto.
¿Cuál es el DAX para esta columna? Si se puede crear en DAX, normalmente puede volver a crearlo en Power Query. Proporcione la muestra más cruda de los datos y, a continuación, el resultado deseado.
Gracias.
Voy a enlazar a otra pregunta con un ejemplo más crudo y el resultado deseado. No sé cómo mostrar rápidamente la fórmula DAX, ya que te di datos ficticios, así que para mí es un poco difícil recrear la fórmula que funcionaría en los valores que elegí en esta pregunta. Esperemos que pueda obtener la idea de los datos en la siguiente pregunta:
https://community.powerbi.com/t5/Desktop/Splitting-the-duration-into-column-names/m-p/1354837
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 |