Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Syndicate_Admin
Administrator
Administrator

Diferencia de fecha

Hola

Necesito ayuda para crear una columna calculada y necesito averiguar el DÍA entre dos fechas que están en las diferentes tablas.

Fecha de entrega - Fecha de envío = DÍA

Cuadro 1

Fecha de envío
1-ene-23
1-ene-23
2-ene-23
3-ene-23
4-ene-23
5-ene-23
5-ene-23
9-ene-23
11-ene-23
11-ene-23
12-ene-23
13-ene-23
11-ene-23
14-ene-23
13-ene-23
14-ene-23
16-ene-23
17-ene-23
14-ene-23
16-ene-23
18-ene-23
13-ene-23
17-ene-23
8-ene-23
13-ene-23

Cuadro 2

Fecha de entrega
1-ene-23
2-ene-23
3-ene-23
4-ene-23
5-ene-23
7-ene-23
10-ene-23
10-ene-23
11-ene-23
12-ene-23
14-ene-23
14-ene-23
15-ene-23
15-ene-23
16-ene-23
17-ene-23
17-ene-23
17-ene-23
18-ene-23
18-ene-23
18-ene-23
19-ene-23
19-ene-23
20-ene-23
20-ene-23

Resultado

Fecha de envíoFecha de entregaDiff
1-ene-231-ene-230
1-ene-232-ene-231
2-ene-233-ene-231
3-ene-234-ene-231
4-ene-235-ene-231
5-ene-237-ene-232
5-ene-2310-ene-235
9-ene-2310-ene-231
11-ene-2311-ene-230
11-ene-2312-ene-231
12-ene-2314-ene-232
13-ene-2314-ene-231
11-ene-2315-ene-234
14-ene-2315-ene-231
13-ene-2316-ene-233
14-ene-2317-ene-233
16-ene-2317-ene-231
17-ene-2317-ene-230
14-ene-2318-ene-234
16-ene-2318-ene-232
18-ene-2318-ene-230
13-ene-2319-ene-236
17-ene-2319-ene-232
8-ene-2320-ene-2312
13-ene-2320-ene-237

Agregaré el DAX a continuación para obtener el resultado final.

Diferencia de fecha =
VAR _diff = TABLA 2 Fecha de envío - Tabla 1 Fecha de entrega, DÍA
DEVOLUCIÓN
SWITCH ( TRUE (),
_diff >= 0 && _diff <= 2, "0-02 días",
_diff >= 3 && _diff <= 7, "03-07 días",
_diff >= 8 && _diff <= 14, "08-14 días",
_diff >= 15 && _diff <= 21, "15-21 días",
_diff >= 22 && _diff <= 30, "22-30 días",
_diff > 30, "más de 31 días", "Error de fecha")

0 REPLIES 0

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors
Top Kudoed Authors