Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hola a todos,
Estoy tratando de calcular la capacidad mensual restante de nuestro equipo después de tener en cuenta los proyectos asignados actualmente en función de las fechas de vencimiento. Debido a que no sé cuándo se usarán las horas del proyecto (solo sé que tiene que ser antes de la fecha de finalización), mi idea es tomar las horas restantes y distribuirlas uniformemente en los meses restantes (los meses restantes incluyen el mes actual y el mes de la fecha de finalización). Esto me permitirá ver cuánta capacidad nos queda para nuevos proyectos.
Mis datos originales se ven así:
| proyecto | asignado a | fecha de inicio | fecha final | Horas del proyecto | Horas de uso |
| Proyecto A | Persona B | Ene-23 | Dic-23 | 30 | 15 |
| Proyecto B | Persona A | Abr-23 | Mar-24 | 20 | 5 |
| Proyecto C | Persona C | Sep-23 | Ago-24 | 50 | 40 |
| Proyecto D | Persona A | Ene-23 | Dic-23 | 100 | 75 |
| Proyecto E | Persona B | Feb-23 | Ene-24 | 20 | 4 |
Estoy tratando de averiguar cómo terminar con algo como esto:
| proyecto | asignado a | mes | horas |
| Proyecto A | Persona B | Dic-23 | 15 |
| Proyecto B | Persona A | Dic-23 | 3.75 |
| Proyecto B | Persona A | Ene-24 | 3.75 |
| Proyecto B | Persona A | Feb-24 | 3.75 |
| Proyecto B | Persona A | Mar-24 | 3.75 |
| Proyecto C | Persona C | Dic-23 | 1.11 |
| Proyecto C | Persona C | Ene-24 | 1.11 |
| Proyecto C | Persona C | Feb-24 | 1.11 |
| Proyecto C | Persona C | Mar-24 | 1.11 |
| Proyecto C | Persona C | Abr-24 | 1.11 |
| Proyecto C | Persona C | Mayo-24 | 1.11 |
| Proyecto C | Persona C | Jun-24 | 1.11 |
| Proyecto C | Persona C | Jul-24 | 1.11 |
| Proyecto C | Persona C | Ago-24 | 1.11 |
| Proyecto D | Persona A | Dic-23 | 25 |
| Proyecto E | Persona B | Dic-23 | 8 |
| Proyecto E | Persona B | Ene-24 | 8 |
Para que pueda verlo visualmente así:
He podido calcular el número de meses que quedan hasta la fecha de finalización, y también el número de horas por mes (número de meses / horas restantes). Pero no puedo averiguar cómo asignarlo a esos meses y luego graficarlo por mes. También me encantaría poder hacer de esto un gráfico de barras apiladas con cada persona para poder ver cuánto del tiempo mensual se atribuye a cada persona. Cualquier ayuda proporcionada será muy apreciada, estoy perdido después de un par de semanas de tratar de resolverlo.
Hola
Este código M generará la tabla deseada
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKijKz0pNLlFIVNJRKkgtKs7PU0gCMr0S83SNjIEMl9RkCMPYAEgYmirF6iA0JSE0gfQ7FhRB1PomAhkmQIYRSBOqnmSEHhAzOLUAosexNB2ixxSkx8QARVMKqkWYrjM0AOkyR7UqFdVPbqlJEMVg7XDnmSjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [project = _t, #"assigned to" = _t, #"start date" = _t, #"end date" = _t, #"project hours" = _t, #"hours used" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"project", type text}, {"assigned to", type text}, {"start date", type date}, {"end date", type date}, {"project hours", Int64.Type}, {"hours used", Int64.Type}}),
#"Remaining hours" = Table.AddColumn(#"Changed Type", "Remaining hours", each [project hours] - [hours used], Int64.Type),
#"Month Span" = Table.AddColumn(#"Remaining hours", "Month Span", each (12 * (Date.Year([end date])-Date.Year(DateTime.Date(DateTime.LocalNow()))))
+ (Date.Month([end date])-Date.Month(DateTime.Date(DateTime.LocalNow())))
+ (if Date.Day(DateTime.Date(DateTime.LocalNow())) > Date.Day([end date])
then -1
else 0
)
+ 2),
#"Monthly hours" = Table.AddColumn(#"Month Span", "Monthly hours", each [Remaining hours] / [Month Span], type number),
#"Added Custom" = Table.AddColumn(#"Monthly hours", "Month List", each List.Numbers(
1,
[Month Span]
)),
#"Expanded Month List" = Table.ExpandListColumn(#"Added Custom", "Month List"),
#"Generate date" = Table.AddColumn(#"Expanded Month List", "Date", each Date.StartOfMonth(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),[Month List]-1)), type date),
#"Removed Columns" = Table.RemoveColumns(#"Generate date",{"start date", "end date", "project hours", "hours used", "Remaining hours", "Month Span", "Month List"})
in
#"Removed Columns"
Espero que esto ayude.
@PBInewbie11 , A mí me parece muy similar el problema de recursos humanos del empleado activo a la solución entre fechas
recomienda
Power BI: HR Analytics - Empleados a la fecha: https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Power BI HR Active Employee Tenure Bucketing y empleados contratados, despedidos y activos: https://youtu.be/fvgcx8QLqZU
Entre fechas- Forma de medir
Medida de Power BI Dax: asignación de datos entre intervalo: https://youtu.be/O653vwLTUzM
Refiérase a los archivos adjuntos
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.