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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Decal
Helper I
Helper I

Slicer using the wrong date of two dates

Hello all,

I have a Access db backend for an HR db that for the purposes of this conversation has two dates:  approved date and filled date.  All positions will have an approved date, but not all have a filled date (since not all positions are filled).  I want to have a time to hire measure that shows average time to hire by month.  Average time to hire only applies if a position has been filled, so the measure should only look at positions that are filled and subtracting from that the approved date to give me average days it took.  

Time to Hire Base =
CALCULATE(
    AVERAGEX(PowerBIPositionQ,DATEDIFF(PowerBIPositionQ[Approved Date],PowerBIPositionQ[Fill Date],DAY))
,(PowerBIPositionQ[Fill Status]="Filled" || PowerBIPositionQ[Fill Status] = "Closed")
)
 
And then I built another measure to be able use it across time:
Avg Time to Hire =
CALCULATE([Time to Hire Base],
FILTER(PowerBIPositionQ,
PowerBIPositionQ[Fill Date]>=FIRSTDATE(dimDate[Date])&&PowerBIPositionQ[Fill Date]<=LASTDATE(dimDate[Date])
)
)
Decal_0-1734133494391.png

 

I have a date table, which is fine and and I've done this part many times.  Both approved date and fill date are connected to the date table with neither of them active.  
 
The Time to Hire Base works fine, but the Avg Time to Hire Measure doesn't seem to calculate.  The page filter is set up Year 2024 or Year 2025.  
 
Apologies for a poorly written problem, but I really can't wrap my head around what's causing the problem enough to put out a well thought out question.  I should note that the one that isn't working crosses years (setup as fiscal, but I don't think that is material)
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Decal ,

Based on the testing, create the sample table.

vjiewumsft_0-1735631863979.png

Then, using the following DAX formula.

 

Avg Time = 
CALCULATE(
    AVERAGEX(
        'PowerBIPosition',
        DATEDIFF(
            'PowerBIPosition'[Approved Date],
            'PowerBIPosition'[Fill Date],
            DAY
        )
    ),
    FILTER(PowerBIPosition, 
        PowerBIPosition[Fill Date] >= FIRSTDATE(DimDate[Date]) && PowerBIPosition[Fill Date] <= LASTDATE(DimDate[Date]) && NOT(ISBLANK('PowerBIPosition'[Fill Date])) && 'PowerBIPosition'[Fill Status] = "Filled")
)

 

Select 2024 year to filter the page. The result is shown below.

vjiewumsft_2-1735632005389.png

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Decal ,

Based on the testing, create the sample table.

vjiewumsft_0-1735631863979.png

Then, using the following DAX formula.

 

Avg Time = 
CALCULATE(
    AVERAGEX(
        'PowerBIPosition',
        DATEDIFF(
            'PowerBIPosition'[Approved Date],
            'PowerBIPosition'[Fill Date],
            DAY
        )
    ),
    FILTER(PowerBIPosition, 
        PowerBIPosition[Fill Date] >= FIRSTDATE(DimDate[Date]) && PowerBIPosition[Fill Date] <= LASTDATE(DimDate[Date]) && NOT(ISBLANK('PowerBIPosition'[Fill Date])) && 'PowerBIPosition'[Fill Status] = "Filled")
)

 

Select 2024 year to filter the page. The result is shown below.

vjiewumsft_2-1735632005389.png

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.  Show the problem there very clearly and also the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Since it's an HR file, I can't provide the whole file, but it can be looked at this way.  

PositionApproved DateFill DateAverage Time to HireTime to Hire Base
1611/17/20236/7/2024203.00203.0
221/1/20241/5/2025 307.0

 

Even if I'm bypassing all of the date tables, why isn't the Avg Time to Hire calculating?


Is that really how your raw data is? You can post a sample data with confidential information removed. That's how most users in the forum do it. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.