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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Laila92
Helper V
Helper V

Dax format measure as date

I have a measure that finds the last date a certain action was done per client (before today). The measure does return the right date but I am not able to format it as a date. I need the measure to be an actual date because I want to be able to find the date diff between the measure date and TODAY().

My Measure:

 

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"))

 


All related date columns are formatted as date. Example of how my output does not work with DATEDIFF(). Strangely, many of the DATEDIFFs do work, see the yellow marked rows, but for some rows the outcome does not make sense. I just guessed this is because my Last Check in measure is not a date. (the "days since call" is a datediff between the above measure and today()). I tried formatting both like:

 

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

 

but this did not work. 

Capture.PNG

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 , somehow to date diff in yellow seems fine to me, First date is smaller 22-May to 27 May is 5 days

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

right. but all the non yellow ones are not fine.

az38
Community Champion
Community Champion

Hi @Laila92 

Check you have no Aggregation in [Days since] column in Visualizations Pane


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

Hi @Laila92 

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


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

Capture.PNG
I dont have that option.

az38
Community Champion
Community Champion

@Laila92 

what exactly statement you use for [Days since call] field?


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))

 

Currently this. But i played around with different formatting optinos.

I dont even have the option to select that.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.