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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Laila92
Helper V
Helper V

Medida de formato Dax como fecha

Tengo una medida que encuentra la última fecha en que se realizó una determinada acción por cliente (antes de hoy). La medida devuelve la fecha correcta, pero no puedo formatearla como fecha. Necesito que la medida sea una fecha real porque quiero poder encontrar la diferencia de fecha entre la fecha de la medida y HOY().

Mi medida:

Last  Call = 
VAR lastCheckIn = IF(CALCULATE(MAX(Activities[Due date]), 
    FILTER(ALLEXCEPT(Deals, Deals[Org Name]), Deals[Activities.Type] = "Check-in Call")
    )<>BLANK(),CALCULATE(MAX(Activities[Due date]), 
    FILTER(ALLEXCEPT(Deals, Deals[Org Name]), Deals[Activities.Type] = "Check-in Call"),
    USERELATIONSHIP(Dates[Date],Activities[Due date]),
    USERELATIONSHIP(Deals[Org Name],Activities[Org Name])


    ),"")
RETURN  

VAR oneBeforeLastCheckIn = IF(CALCULATE(MAX(Activities[Due date]), 
    FILTER(ALLEXCEPT(Deals, Deals[Org Name]), Deals[Activities.Type] = "Check-in Call")
    )<>BLANK(),CALCULATE(MAX(Activities[Due date]), 
    FILTER(ALLEXCEPT(Deals, Deals[Org Name]), Deals[Activities.Type] = "Check-in Call"),
    FILTER(Activities,Activities[Due date]<TODAY()),
    USERELATIONSHIP(Dates[Date],Activities[Due date]),
    USERELATIONSHIP(Deals[Org Name],Activities[Org Name])

    ),"")
  

return

VAR correctDate = IF(lastCheckIn>TODAY(),oneBeforeLastCheckIn,lastCheckIn)
RETURN

IF ( correctDate = BLANK(), 0, FORMAT(correctDate+ DATE ( 1899, 12, 30 ),"DD/MM/yyyy"))


Todas las columnas de fecha relacionadas tienen el formato de fecha. Ejemplo de cómo mi salida no funciona con DATEDIFF(). Extrañamente, muchos de los DATEDIFF funcionan, ven las filas marcadas de amarillo, pero para algunas filas el resultado no tiene sentido. Acabo de adivinar esto es porque mi último cheque en medida no es una fecha. (los "días desde la llamada" es una fecha diferente entre la medida anterior y today()). Traté de formatear ambos como:

 FORMAT([Today],"YYYY/MM/DD")

pero esto no funcionó.

Capture.PNG

1 ACCEPTED SOLUTION
Laila92
Helper V
Helper V

I actually found a new way to calculate my original measure that preserved the date, and that also fixed the DATEDIFF metric. this is the new measure:

Last Call = 
MAXX(
    SUMMARIZE(
        Deals,
        Activities_Lookup[Org Name],
        "Last call", CALCULATE(MAX(Activities_Lookup[Due date]),
                            FILTER(Activities_Lookup,Activities_Lookup[Type]="Check-In Call"),
                            FILTER(Activities_Lookup,Activities_Lookup[Done]="Done"),
                            FILTER(Activities_Lookup,Activities_Lookup[Due date]<=TODAY())
                        )
            ),
   [Last call]
   )

View solution in original post

9 REPLIES 9
Laila92
Helper V
Helper V

I actually found a new way to calculate my original measure that preserved the date, and that also fixed the DATEDIFF metric. this is the new measure:

Last Call = 
MAXX(
    SUMMARIZE(
        Deals,
        Activities_Lookup[Org Name],
        "Last call", CALCULATE(MAX(Activities_Lookup[Due date]),
                            FILTER(Activities_Lookup,Activities_Lookup[Type]="Check-In Call"),
                            FILTER(Activities_Lookup,Activities_Lookup[Done]="Done"),
                            FILTER(Activities_Lookup,Activities_Lookup[Due date]<=TODAY())
                        )
            ),
   [Last call]
   )
amitchandak
Super User
Super User

@Laila92 , de alguna manera a la fecha diff en amarillo me parece bien, La primera fecha es más pequeña del 22 al 27 de mayo es de 5 días

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Correcto. pero todos los no amarillos no están bien.

az38
Community Champion
Community Champion

Hola @Laila92

Compruebe que no tiene agregación en la columna [Días desde] en el Panel de visualizaciones


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
az38
Community Champion
Community Champion

Hola @Laila92

Безымянный.png


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Capture.PNG
No tengo esa opción.

az38
Community Champion
Community Champion

@Laila92

¿qué declaración se utiliza exactamente para el campo [Días desde la llamada]?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Days since last Checkin = 
var lastCall = [Last Check-In Call]
var today = FORMAT([Today],"YYYY/MM/DD")
RETURN
 IF([Last Check-In Call]=0,"",DATEDIFF(lastCall,TODAY(),DAY))

Actualmente esto. Pero jugué con diferentes optinos de formato.

Ni siquiera tengo la opción de seleccionar eso.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Top Kudoed Authors