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

Distribuir horas de trabajo

Hola

Necesito pronosticar horas de trabajo distribuyendo la hora durante el día de duración.

Usaré un ejemplo para ser más claro.

Quiero saber cuántas horas al día tendré que trabajar.

¿Cómo creo una tabla que se parezca al resultado?

Tabla1:

EtienneB1_0-1596760010424.png

Tabla 2:

EtienneB1_1-1596760056597.png


Resultado:

EtienneB1_2-1596760097446.png

Por favor, ayuda que he estado atrapado aquí durante semanas

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hola @EtienneB1 ,

¿Qué tal crear una tabla calculada así:

Crossjoin Table =
SUMMARIZE (
    FILTER (
        ADDCOLUMNS (
            CROSSJOIN ( CALENDARAUTO (), 'Table 1', 'Table 2' ),
            "enddate", [Start Date]
                + CALCULATE (
                    SUM ( 'Table 2'[Duration(days)] ) - 1,
                    FILTER (
                        ALL ( 'Table 2' ),
                        'Table 2'[Process Name] <= EARLIER ( 'Table 2'[Process Name] )
                    )
                ),
            "Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)]
        ),
        VAR StartDate_ = [enddate] - [Duration(days)] + 1
        RETURN
            [Date] <= [enddate]
            && [Date] >= StartDate_
    ),
    [Date],
    [Id],
    [Process Name],
    [Hours]
)

crossjoin.PNG

Para obtener más detalles, consulte el archivo .pbix adjunto.

Saludos

Icey

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

5 REPLIES 5
Icey
Community Support
Community Support

Hola @EtienneB1 ,

Tal vez esto sea más útil para su comprensión:

Entiendo lo siguiente:

Desea calcular los resultados de "Cantidad*Tiempo por unidad/duración".

Si mi entendimiento es correcto, prueba esto:

1. Cree una columna calculada que calcule la duración de progress1 y progress2.

duration1 =
CALCULATE (
    SUM ( 'Table 2'[Duration(days)] ),
    FILTER (
        ALL ( 'Table 2' ),
        'Table 2'[Process Name] <= EARLIER ( 'Table 2'[Process Name] )
    )
)

duration1.png

2. Cree una nueva tabla en Modelado.

Table 3 = 
VAR mycalendar =
    CALENDARAUTO ()
VAR table1 =
    ADDCOLUMNS (
        CROSSJOIN ( 'Table 1', 'Table 2', mycalendar ),
        "EndDate", 'Table 1'[Start Date] + 'Table 2'[duration1]
    )
VAR table2 =
    ADDCOLUMNS ( table1, "StartDate1", [EndDate] - 'Table 2'[Duration(days)] )
VAR table3 =
    ADDCOLUMNS (
        FILTER ( table2, [StartDate1] <= [Date] && [EndDate] >= [Date] ),
        "Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)]
    )
RETURN
    SUMMARIZE (
        ADDCOLUMNS (
            table3,
            "Hours1", [Qty] & "*" & [Time per Unit(hours)] & "/" & [Duration(days)]
        ),
        [Date],
        [Id],
        [Process Name],
        [Hours1],
        [Hours]
    )

table3-1.png

Puede consultar más detalles desde aquí.

Saludos

Icey

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Icey
Community Support
Community Support

Hola @EtienneB1 ,

¿Qué tal crear una tabla calculada así:

Crossjoin Table =
SUMMARIZE (
    FILTER (
        ADDCOLUMNS (
            CROSSJOIN ( CALENDARAUTO (), 'Table 1', 'Table 2' ),
            "enddate", [Start Date]
                + CALCULATE (
                    SUM ( 'Table 2'[Duration(days)] ) - 1,
                    FILTER (
                        ALL ( 'Table 2' ),
                        'Table 2'[Process Name] <= EARLIER ( 'Table 2'[Process Name] )
                    )
                ),
            "Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)]
        ),
        VAR StartDate_ = [enddate] - [Duration(days)] + 1
        RETURN
            [Date] <= [enddate]
            && [Date] >= StartDate_
    ),
    [Date],
    [Id],
    [Process Name],
    [Hours]
)

crossjoin.PNG

Para obtener más detalles, consulte el archivo .pbix adjunto.

Saludos

Icey

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Muchas gracias por su ayuda.
Una cosa más, Si tengo IDs que tienen un flujo de trabajo diferente, Lo que quiero decir que no hace todos los procesos tal vez omitido uno o pocos.
¿Cómo puedo hacerlo?

Icey
Community Support
Community Support

Hola @EtienneB1 ,

No entiendo muy bien el escenario que mencionaste. Por favor, dame un ejemplo específico para ayudarme a entender mejor sus necesidades.

Saludos

Icey

amitchandak
Super User
Super User

@EtienneB1 , Puede utilizar tabla cruzada con addcolumns, summarize, summarizecolumns

Ejemplo

addcolumns(crorsstable(Table1, Table2), "Hours" , divide([Qty]*[Time per unit(Hour)],[Duration]))

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.