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

Nueva columna con fecha calculada

Hola a todos
Tengo que calcular una nueva fecha de pedido sabiendo que
_se se ha introducido la fecha de pedido> 16.00 tengo que añadir 1 día.
_se la fecha calculada cae en un día festivo (Sáb. Dom. Tengo que posponerlo hasta el primer día laborable.
Entré en una tabla de calendario con sólo días laborables, con la función "IF" puedo posponer en un día los datos calculados PERO no puedo de ninguna manera posponer la fecha a la primera jornada laboral útil
Estoy atascado en este punto, espero que alguien pueda ayudarme
gracias de antemano!

1 ACCEPTED SOLUTION

Grazie molte, ho risolto il mio problema con una piccola modifica al tuo suggerimento.

NewDate =
IF (
'Intestazione vendite OSC $' [Ora]> TIMEVALUE ("15:59:59");
IF (
WEEKDAY ([Date Order]; 2)> = 5;
DATE (YEAR ([ORDER DATE]); MESE ([Data ordine]); GIORNO ([DATA ORDINE]) + 7
- WEEKDAY ([Data ordine]; 2) + 1);
DATA (ANNO ([Data ordine]); MESE ([Data ordine]); GIORNO ([Data ordine]) + 1)
);
"Intestazione vendite OSC $" [Data ordine]
)

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

HOLA @Denpowerbi,

Creo que necesita agregar condiciones a if statement para comprobar su día de la semana y hora. Por favor, eche un vistazo a la siguiente fórmula de cálculo de columna si cumple con sus requisitos:

NewDate = 
IF (
    HOUR ( [Datetime] ) >= 16,
    IF (
        WEEKDAY ( [Datetime], 2 ) >= 5,
        DATE ( YEAR ( [Datetime] ), MONTH ( [Datetime] ), DAY ( [Datetime] ) + 7
            - WEEKDAY ( [Datetime], 2 ) + 1 ),
        DATE ( YEAR ( [Datetime] ), MONTH ( [Datetime] ), DAY ( [Datetime] ) + 1 )
    ),
    IF (
        WEEKDAY ( [Datetime], 2 ) >= 5,
        DATE ( YEAR ( [Datetime] ), MONTH ( [Datetime] ), DAY ( [Datetime] ) + 7
            - WEEKDAY ( [Datetime], 2 ) + 1 ),
        [Datetime]
    )
)

saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Grazie molte, ho risolto il mio problema con una piccola modifica al tuo suggerimento.

NewDate =
IF (
'Intestazione vendite OSC $' [Ora]> TIMEVALUE ("15:59:59");
IF (
WEEKDAY ([Date Order]; 2)> = 5;
DATE (YEAR ([ORDER DATE]); MESE ([Data ordine]); GIORNO ([DATA ORDINE]) + 7
- WEEKDAY ([Data ordine]; 2) + 1);
DATA (ANNO ([Data ordine]); MESE ([Data ordine]); GIORNO ([Data ordine]) + 1)
);
"Intestazione vendite OSC $" [Data ordine]
)

amitchandak
Super User
Super User

@Denpowerbi ,

para comprobar el tiempo que puede utilizar

Prueba en una nueva columna algo como esto

if([date].time > time(16,0,0) ,[date]+1,[date])

hacer añadir restar día de trabajo ver si mi blog puede ayudar

https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calenda...

Gracias, para comprobar la hora bien.
He mirado tu blog, muy interesante, pero todavía no puedo administrar los datos solo el primer día.

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.