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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
azakir
Resolver I
Resolver I

DISTINCTCOUNT of employees based on arguments

Hi Guys. 

Looking for some help with measures/calculated columns. 

azakir_0-1665388355877.png

 

 

Goal is to come up with a calculation that identifies whether: 

 

  • Employee had salary change with grade change
  • Employee had salary change with no grade change

From above example, Emp2 had both grade and salary change in Feb-22, but then again, changed salary in Mar-222 but grade remained the same. Emp3 had changes all the 3 months. 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@azakir , With help from a date Table

 

This Month Grade= CALCULATE(Max(Table[Grade]),DATESMTD('Date'[Date]))
Last Month Grade= CALCULATE(Max(Table[Grade]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

This Month Salary= CALCULATE(Max(Table[Salary]),DATESMTD('Date'[Date]))
Last Month Salary= CALCULATE(Max(Table[Salary]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

now create measures like

Changed grade
countx(values(Table[Employee]), if(not(isblank([This Month Grade])) && not(isblank([Last Month Grade])) && [This Month Grade] <> [Last Month Grade], [Employee], blank()))

 

Do same for salary

 

A modified approch above, what I discussed in this blog

https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@azakir , With help from a date Table

 

This Month Grade= CALCULATE(Max(Table[Grade]),DATESMTD('Date'[Date]))
Last Month Grade= CALCULATE(Max(Table[Grade]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

This Month Salary= CALCULATE(Max(Table[Salary]),DATESMTD('Date'[Date]))
Last Month Salary= CALCULATE(Max(Table[Salary]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

now create measures like

Changed grade
countx(values(Table[Employee]), if(not(isblank([This Month Grade])) && not(isblank([Last Month Grade])) && [This Month Grade] <> [Last Month Grade], [Employee], blank()))

 

Do same for salary

 

A modified approch above, what I discussed in this blog

https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...

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

Hi @amitchandak . Thanks for your help mate. This worked a charm. Double Kudos to you if I had the oppurtunity 🙂

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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