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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
KMEAGHER
Advocate I
Advocate I

Percent distinct values year over year

Hello, 

 

I am trying to create a measure to calculate teacher turnover within the table below. Each teacher has a unique research ID, and the file contains 9 years of data. I essentially want to calculate the percent of Research ID's that were retained from one year to the next, but am stumped on how to do it. Any ideas on a calculation? Thanks!

 

KMEAGHER_0-1747074566881.png

 

1 ACCEPTED SOLUTION
maruthisp
Solution Specialist
Solution Specialist

Hi @KMEAGHER,
Please find the attached pbix file, that will show the TratainedTeachers and Retention% values as per the sample data which I considered.

maruthisp_0-1747196036083.png

Percent distinct values year over year.pbix


Please let me know if you have further questions.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

View solution in original post

4 REPLIES 4
maruthisp
Solution Specialist
Solution Specialist

Hi @KMEAGHER,
Please find the attached pbix file, that will show the TratainedTeachers and Retention% values as per the sample data which I considered.

maruthisp_0-1747196036083.png

Percent distinct values year over year.pbix


Please let me know if you have further questions.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

thank you @maruthisp that worked!

bhanu_gautam
Super User
Super User

@KMEAGHER You can create a measure that calculates the percentage of Research IDs retained from one year to the next. 

Create a Calculated Column for Year: Year = YEAR([School Year])

 

Create a Measure for Retained Teachers:

RetainedTeachers =
VAR CurrentYear = MAX('Table'[Year])
RETURN
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[Year] = CurrentYear &&
'Table'[Research Id] IN
CALCULATETABLE(
VALUES('Table'[Research Id]),
'Table'[Year] = CurrentYear - 1
)
)
)

 

Create a Measure for Total Teachers in Previous Year:

TotalTeachersPreviousYear =
VAR CurrentYear = MAX('Table'[Year])
RETURN
CALCULATE(
COUNTROWS('Table'),
'Table'[Year] = CurrentYear - 1
)

 

Create the Turnover Rate Measure:

TurnoverRate =
DIVIDE(
[RetainedTeachers],
[TotalTeachersPreviousYear],
0
)

 

Use a line chart or any other suitable visualization to display the turnover rate over the years.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






thank you @bhanu_gautam for the suggestion. The TotalTeachersPreviousYear measure worked great, however the RetainedTeachers measure is not working. It doesn't show an error message, however nothing appears when I add it to a visual. 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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