The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
Solved! Go to Solution.
Hi @Decal ,
Based on the testing, create the sample table.
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.
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.
Hi @Decal ,
Based on the testing, create the sample table.
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.
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.
Hi,
Share the download link of the PBI file. Show the problem there very clearly and also the expected result.
Since it's an HR file, I can't provide the whole file, but it can be looked at this way.
Position | Approved Date | Fill Date | Average Time to Hire | Time to Hire Base |
16 | 11/17/2023 | 6/7/2024 | 203.00 | 203.0 |
22 | 1/1/2024 | 1/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.