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
Anonymous
Not applicable

Ayuda para excluir vacaciones

Hola a todos.

Tengo la siguiente consulta para obtener los días entre dos fechas excluyendo los fines de semana, así que ahora necesito excluir días festivos también, ¿alguien tiene una solución para ello? Tengo vacaciones de otra mesa

Consulta:

Dejar
Source (InitialDate como fecha, FinalDate como fecha) como número ?>
Dejar
DaysBetweenDates - Duration.Days(FinalDate-InitialDate)
DaysList : List.Dates(List.Min('InitialDate,FinalDate'),Number.Abs(DaysBetweenDates)+1, Duration.From(1)),
WeekDaysList á List.Select(DaysList, each (Date.DayOfWeek(_, Day.Monday) < 5) ),
WorkingDays (si DaysBetweenDates < 0 entonces -1 más 1) * List.Count(WeekDaysList)
En
WorkingDays
En
Fuente

saludos

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hola @sanchezj5 ,

Prueba éste:

Dejar
Source (InitialDate como fecha, FinalDate como fecha) como número ?>
Dejar
DaysBetweenDates - Duration.Days(FinalDate-InitialDate),
DaysList : List.Dates(List.Min('InitialDate,FinalDate'),Number.Abs(DaysBetweenDates)+1, Duration.From(1)),
WeekDaysList á List.Select(DaysList, each (Date.DayOfWeek(_, Day.Monday) < 5) ),
WorkingDays (si DaysBetweenDates < 0 entonces -1 más 1) * List.Count(WeekDaysList),
Vacaciones : List.Select(Holiday[Date], each Date.From(_) >' InitialDate y Date.From(_) <- FinalDate),
Resultado: WorkingDays - List.Count(Holidays)
En
Resultado
En
Fuente

¿Respondí a tu pregunta? ¡Marca mi puesto como solución!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

3 REPLIES 3
camargos88
Community Champion
Community Champion

Hola @sanchezj5 ,

Prueba éste:

Dejar
Source (InitialDate como fecha, FinalDate como fecha) como número ?>
Dejar
DaysBetweenDates - Duration.Days(FinalDate-InitialDate),
DaysList : List.Dates(List.Min('InitialDate,FinalDate'),Number.Abs(DaysBetweenDates)+1, Duration.From(1)),
WeekDaysList á List.Select(DaysList, each (Date.DayOfWeek(_, Day.Monday) < 5) ),
WorkingDays (si DaysBetweenDates < 0 entonces -1 más 1) * List.Count(WeekDaysList),
Vacaciones : List.Select(Holiday[Date], each Date.From(_) >' InitialDate y Date.From(_) <- FinalDate),
Resultado: WorkingDays - List.Count(Holidays)
En
Resultado
En
Fuente

¿Respondí a tu pregunta? ¡Marca mi puesto como solución!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hola @camargos88

Muchas gracias!! me salvaste

Probé este método y funciona 😄

saludos

amitchandak
Super User
Super User

@sanchezj5 , consulte este archivo en cuanto a cómo he utilizado el calendario para obtener días laborables. Compruebe si hay días laborables

https://www.dropbox.com/s/y47ah38sr157l7t/Order_delivery_date_diff.pbix?dl=0

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.