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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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...

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...

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.