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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
abisrani
Helper I
Helper I

Dynamically calculate days of service column

Hello Community,

 

I have a dashboard where I am trying to calculate the years of service for a salesperson, just like calculating age for someone as of the selected date. I have a date slicer on the dashboard and the years slicer, where a user can select date and also years from the slicers. 
 let us say someone selected the date and then there is another filter on the dashboard which has fields 1 year, 2 years, 3 years, 4 years, 5 years of service.  Now the start date and end date should work to calculate the days of service based on the selected field.

abisrani_0-1714162127117.png

My Sales table has the data which consists of sales id , start date, and end date. I want to dynamically calculate a column based on the visual slicers above where the user will first select the date let us say today's date and 3 from the other slicer. This should calculate the days of service dynamically from sales table from the start date and the selected date in the slicer and should only return the values which is there for 3 years with us.

 

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @abisrani 

Days of service can be calculated by creating a measure in a data model with two disconnected tables:

1. Sales rep table with the information of sales rep ID, start date, end date

2. Calendar table

 

You can for example, write a measure like below to flexiblty analyse the tenure information with respect to the time dimension:

DataNinja777_0-1714284151818.png

The article in the link below shows technique of employee headcount and tenure which can be applied to salesperson year of service, too.

 

https://p3adaptive.com/finding-the-magic-part-2-on-the-way-to-data-happiness/

Best regards,

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @abisrani ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
DataNinja777
Super User
Super User

Hi @abisrani 

Days of service can be calculated by creating a measure in a data model with two disconnected tables:

1. Sales rep table with the information of sales rep ID, start date, end date

2. Calendar table

 

You can for example, write a measure like below to flexiblty analyse the tenure information with respect to the time dimension:

DataNinja777_0-1714284151818.png

The article in the link below shows technique of employee headcount and tenure which can be applied to salesperson year of service, too.

 

https://p3adaptive.com/finding-the-magic-part-2-on-the-way-to-data-happiness/

Best regards,

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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