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
Anonymous
Not applicable

Finding Historical Data

Hi All, 

 

I have a dataset similar to the below.

 

IDOn Hire DateOff Hire Date
1  
201/01/202130/01/2021
301/02/2021 
401/03/202110/03/2021
501/04/202125/06/2021

 

I have created a visual which tells me how many ID's are On Hire based on todays data

Logic - Count of ID's filtered by On Hire Date is set, Off Hire Date is blank

 

I want to create another visual that tells me how many ID's are On Hire based upon a certain data. For example, if a date slicer was set back to 05/03/2021 it would state how many ID's where On Hire at that certain time. Looking at the above dataset this would return a value of 2 for ID's 3 & 4.

 

I would also require a feature to see the average amount on hire per month? This visual would require a data difference timeline slicer and take the average amount of ID's on hire over the selected perioid.

 

How can this be achieved?

 

Many thanks 🙂 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try:

On Hire based on today = CALCULATE(COUNTROWS('Table'),FILTER('Table',[On Hire Date]<>BLANK()&&  [On Hire Date]<=TODAY() && [Off Hire Date]=BLANK()))

Eyelyn9_0-1644890424020.png

 

If you want to calculate the count based on some selections, please firstly create a new calendar table with Dates for slicer

Calendar = CALENDAR(MIN('Table'[On Hire Date]), MAX('Table'[Off Hire Date]))
On Hire at certain time = CALCULATE(COUNTROWS('Table'),FILTER('Table',[On Hire Date]<>BLANK()&&  [On Hire Date]<=MAX('Calendar'[Date]) && ([Off Hire Date]=BLANK()|| [Off Hire Date]>=MAX('Calendar'[Date]))))

Eyelyn9_1-1644890497471.png

 

On Hire over selected perioid = CALCULATE(COUNTROWS('Table'),FILTER('Table',[On Hire Date]<>BLANK() && [On Hire Date]<=MIN('Calendar'[Date]) && ( [Off Hire Date]>=MAX('Calendar'[Date]) || [Off Hire Date]=BLANK())))

Eyelyn9_2-1644890533313.png

 

 Best Regards,
Eyelyn Qin
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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try:

On Hire based on today = CALCULATE(COUNTROWS('Table'),FILTER('Table',[On Hire Date]<>BLANK()&&  [On Hire Date]<=TODAY() && [Off Hire Date]=BLANK()))

Eyelyn9_0-1644890424020.png

 

If you want to calculate the count based on some selections, please firstly create a new calendar table with Dates for slicer

Calendar = CALENDAR(MIN('Table'[On Hire Date]), MAX('Table'[Off Hire Date]))
On Hire at certain time = CALCULATE(COUNTROWS('Table'),FILTER('Table',[On Hire Date]<>BLANK()&&  [On Hire Date]<=MAX('Calendar'[Date]) && ([Off Hire Date]=BLANK()|| [Off Hire Date]>=MAX('Calendar'[Date]))))

Eyelyn9_1-1644890497471.png

 

On Hire over selected perioid = CALCULATE(COUNTROWS('Table'),FILTER('Table',[On Hire Date]<>BLANK() && [On Hire Date]<=MIN('Calendar'[Date]) && ( [Off Hire Date]>=MAX('Calendar'[Date]) || [Off Hire Date]=BLANK())))

Eyelyn9_2-1644890533313.png

 

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

amitchandak
Super User
Super User

@Anonymous , Where is the amount column?

 

refer if this blog can help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

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.