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.
Buenas, estoy intentando hacer un pivot en una tabla para obtenet un total, pero no lo consigo. Necesitaria vuestra ayuda por que estoy totalmente bloqueado. Os muestro:
Tengo una tabla con la lista de departamentos, usuarios y cursos que ha hecho cada usuario, y necesito transformarla en una tabla que unica mente muestre el departamento y el total de usuarios de ese departamento, algo asi:
Agradeceria vuestra ayuda!!! 🙂
Solved! Go to Solution.
Hello @Fernandez
Attached file shows how you can do it in Power Query.
Following is the Power Query code:
let
Source = Excel.Workbook(File.Contents("C:\...........\Department.xlsx"), null, true),
Sheet1_Sheet = Source{[Item="Table",Kind="Sheet"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Sheet1_Sheet,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Departamento", type text}, {"usuario", type text}, {"cursos", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"cursos"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"Departamento"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}})
in
#"Grouped Rows"
You need to delete cursos field first.
Then right click on Departmento column in Power Query and select Group By (Count Distinct Rows)
Hello @Fernandez
Create a matrix visual and add the fields in the sections shown in the image below.
Also attached the workspace
Hi @themistoklis , first to all thx for your answer. I need the table in the data model, I mean from the transform data option, I would like to create a table with the data grouped by Department(Departamento). , but i can't do it, any idea? thanks again!
Hello @Fernandez
Attached file shows how you can do it in Power Query.
Following is the Power Query code:
let
Source = Excel.Workbook(File.Contents("C:\...........\Department.xlsx"), null, true),
Sheet1_Sheet = Source{[Item="Table",Kind="Sheet"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Sheet1_Sheet,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Departamento", type text}, {"usuario", type text}, {"cursos", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"cursos"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"Departamento"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}})
in
#"Grouped Rows"
You need to delete cursos field first.
Then right click on Departmento column in Power Query and select Group By (Count Distinct Rows)
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 |
---|---|
43 | |
23 | |
21 | |
15 | |
15 |
User | Count |
---|---|
45 | |
31 | |
30 | |
18 | |
17 |