Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hola, tengo 2 perreras de alojamiento para perros y quiero saber el recuento de días entre el final anterior del perro y el comienzo del nuevo para cada habitación.
Por ejemplo, la diferencia de días entre Perro1 y Perro2 en abril 2024 A1 es de 2 días.
No tengo la columna Days_to_Fill en mis datos de origen.
| Ubicación | Cuarto | Dog_Number | Start_Date | End_Date | Days_to_Fill |
| Mánchester | A1 | 1 | 01/04/2024 | 10/04/2024 | 2 |
| Mánchester | A1 | 2 | 13/04/2024 | 18/04/2024 | 7 |
| Mánchester | A1 | 3 | 26/04/2024 | 28/04/2024 | 5 |
| Mánchester | A1 | 4 | 03/05/2024 | 15/05/2024 | |
| Newcastle | B1 | 5 | 01/07/2024 | 12/07/2024 | 4 |
| Newcastle | B1 | 6 | 17/07/2024 | 23/07/2024 | 15 |
| Newcastle | B1 | 7 | 08/08/2024 | 18/08/2024 | 2 |
| Newcastle | B1 | 8 | 21/08/2024 | 25/08/2024 |
Gracias
DAX para una columna calculada:
Days_to_Fill =
VAR CurrentStart = 'Table'[Start_Date]
VAR CurrentRoom = 'Table'[Room]
VAR CurrentLocation = 'Table'[Location]
VAR PreviousEnd =
MAXX(
FILTER(
'Table',
'Table'[Room] = CurrentRoom &&
'Table'[Location] = CurrentLocation &&
'Table'[End_Date] < CurrentStart
),
'Table'[End_Date]
)
RETURN
IF(
NOT ISBLANK(PreviousEnd),
DATEDIFF(PreviousEnd, CurrentStart, DAY),
BLANK()
)
💌 Si esto ayudó, ¡una marca ✅ de Kudos 👍 o Solution sería genial! 🎉
Bien
Kedar
Conéctate en LinkedIn
Estoy bastante confundido
Fila 1: Del 10 al 13 de abril = 3 días
Fila 2 : 18 de abril al 26 de abril = 8 días
Estas deberían ser las diferencias en días
| Ubicación | Cuarto | Dog_Number | Start_Date | End_Date | Days_to_Fill | diferencia |
| Mánchester | A1 | 1 | 01/04/2024 | 10/04/2024 | 2 | 3 |
| Mánchester | A1 | 2 | 13/04/2024 | 18/04/2024 | 7 | 8 |
| Mánchester | A1 | 3 | 26/04/2024 | 28/04/2024 | 5 | 5 |
| Mánchester | A1 | 4 | 03/05/2024 | 15/05/2024 | ||
| Newcastle | B1 | 5 | 01/07/2024 | 12/07/2024 | 4 | 5 |
| Newcastle | B1 | 6 | 17/07/2024 | 23/07/2024 | 15 | 16 |
| Newcastle | B1 | 7 | 08/08/2024 | 18/08/2024 | 2 | 3 |
| Newcastle | B1 | 8 | 21/08/2024 | 25/08/2024 |
Es una columna calculada
Difference =
VAR NextStart =
CALCULATE (
MIN ( 'Table'[Start_Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[Room] = EARLIER ( 'Table'[Room] )
&& 'Table'[Start_Date] > EARLIER ( 'Table'[Start_Date] )
)
)
RETURN
DATEDIFF ( 'Table'[End_Date], NextStart, DAY )
Esto funcionó perfectamente, ¡gracias!
Hola @RichOB ,
Por favor, pruebe a continuación DAX :
Hola @AnkitaaMishra muchas gracias por tu ayuda. Tengo un error DAX de "No se puede convertir el valor 'Manchester' de tipo Texto a tipo Verdadero/Falso". ¿Sabes cómo resolvería esto, por favor?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.