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
fernandoC
Helper V
Helper V

Date Diff Formula

Hi!,

 

I'm trying to obtain the Time to Hire for a specific dataset which is the date difference between the contact date of a candidate and the resolution of the position. I've created the following formula, however, I receive an error message: An Argument of the function 'Date' has the wrong data type or the result is too big or too small. 

Time to Hire =
VAR Iscandidate = CALCULATE(COUNTROWS(FILTER('Main Jira Info','Main Jira Info'[Status Name] = "Candidate")))
VAR Candidatedate = IF(Iscandidate,DATE('Main Jira Info'[CREATED Date].[Day],0,0),BLANK())
VAR Ishired = CALCULATE(COUNTROWS(FILTER('Main Jira Info','Main Jira Info'[Requisition Decision] = "Filled")))
VAR Hiredate = IF(Ishired,DATE('Main Jira Info'[RESOLUTIONDATE].[Day],0,0),BLANK())
RETURN DATEDIFF(Candidatedate,Hiredate,DAY)
 
Any suggestions?.
 
Thanks in advance.
 
Best, 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @fernandoC ,

The error is caused by the two dates quoted(see the part with red circle) do not match the date format...You can refer this link about the usage of Date function.

quoted date fields.JPG

First, please make sure the data type of field 'Main Jira Info'[CREATED Date] and 'Main Jira Info'[Requisition Decision] are Date, then update the formula of calculated column [Time to Hire] as below:

Time to Hire =
VAR Candidatedate =
    IF (
        'Main Jira Info'[Status Name] = "Candidate",
        'Main Jira Info'[CREATED Date],
        BLANK ()
    )
VAR Hiredate =
    IF (
        'Main Jira Info'[Requisition Decision] = "Filled",
        'Main Jira Info'[RESOLUTIONDATE],
        BLANK ()
    )
RETURN
    DATEDIFF ( Candidatedate, Hiredate, DAY )​

If the above method doesn't work, please provide some sample data in table Main Jira Info and explain what you want. Thank you.

Best Regards

Rena

 

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@fernandoC , .day is used

Time to Hire =
VAR Iscandidate = CALCULATE(COUNTROWS(FILTER('Main Jira Info','Main Jira Info'[Status Name] = "Candidate")))
VAR Candidatedate = IF(Iscandidate,DATE('Main Jira Info'[CREATED Date].Date,0,0),BLANK())
VAR Ishired = CALCULATE(COUNTROWS(FILTER('Main Jira Info','Main Jira Info'[Requisition Decision] = "Filled")))
VAR Hiredate = IF(Ishired,DATE('Main Jira Info'[RESOLUTIONDATE].Date,0,0),BLANK())
RETURN DATEDIFF(Candidatedate,Hiredate,DAY)

 

Also if the date does not have a timestamp. then you avoid .date

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

Hi @amitchandak ,

 

Thank you for your help!.

 

I've updated the formula  as you mentioned but I'm still receiving the same error message: 

 

time to hire.PNG

 

Also tried to remove the .[Date] as the columns being referenced only have date but not a timestamp but still receive the same error message. 

 

Best, 

Anonymous
Not applicable

Hi @fernandoC ,

The error is caused by the two dates quoted(see the part with red circle) do not match the date format...You can refer this link about the usage of Date function.

quoted date fields.JPG

First, please make sure the data type of field 'Main Jira Info'[CREATED Date] and 'Main Jira Info'[Requisition Decision] are Date, then update the formula of calculated column [Time to Hire] as below:

Time to Hire =
VAR Candidatedate =
    IF (
        'Main Jira Info'[Status Name] = "Candidate",
        'Main Jira Info'[CREATED Date],
        BLANK ()
    )
VAR Hiredate =
    IF (
        'Main Jira Info'[Requisition Decision] = "Filled",
        'Main Jira Info'[RESOLUTIONDATE],
        BLANK ()
    )
RETURN
    DATEDIFF ( Candidatedate, Hiredate, DAY )​

If the above method doesn't work, please provide some sample data in table Main Jira Info and explain what you want. Thank you.

Best Regards

Rena

 

 

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.