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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Honne2021
Helper II
Helper II

Dynamic calculation of tenure based on selected month slicer

Hi, 

I have a data that looks like this. A person has multiple rows of data. Each event (such as promotion, hire, termination, rehire) equates to one row of data. I need to get each of their tenure and then add group/bin them accordingly.

 

If the current status is active then Newest Employment Date - Maximum Date based on selected slicer in the report. (if the slicer selected is Mar 2022, the max date is Mar 31 2022). Thus, Newest employment date - mar 31 2022. The max date adjusts based on the selected slicer. 

 

If the current status is terminated then newest employment date - termination date.
If the selected slicer is less than the termination date then use that lesser date (because technically, it makes sense that way)

Then I should group them by 0-6 Months, 1-5 years, 6-10 years and so on and by their teams as well. Result should be a table that looks like this:

 0-6 Months1-5 Years6-10 years
IT1052
HR242
Total1294



Raw Data:

 Newest Employment DateNew Termination DateEventCurrent StatusTeam
Anne20/03/2021 HireActiveIT
Anne20/03/202109/02/2017TerminatedActiveIT
Anne20/03/2021 RehireActiveIT
      
Ben19/07/202229/12/2022HireTerminatedHR
Ben19/07/202229/12/2022TerminatedTerminatedHR
      
      
Carl19/07/2022 HireActiveIT
Carl19/07/2022 PromotionActiveIT
Carl19/07/2022 Change in Job TitleActiveIT
2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @Honne2021 ,

For now, the advice I can provide is to create a separate calendar table to provide filtered dates for the slicer.

The raw data provided seems a matrix visual in Power BI, right?

What does your data look like in data view in Power BI Desktop?

Please explain again how the expected results of IT and HR in the [0-6 Months] column came from, and if so, it is best to explain it based on the raw data from data view.

 

 

 

Best Regards,

Stephen Tao

 

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

Hi @v-stephen-msft ,

Sorry I think I wasnt clear on that. Here is a screenshot of an excel file I created to explain it clearly:

Picture1.png

 I already have a date table. 🙂

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.