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
Anonymous
Not applicable

Measure that check if the user ID is available in previous month or not

Hello, I have managed to create a monthly Database that contains employee ID

 

I want a measure that check if this employee ID is available in the pervious month, If its not available then the Employee is New.

 

Same thing goes to Leavers, I want it to check the next month to check if the employee left or not

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , I think you need very similar what I disucssed here

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

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
Anonymous
Not applicable

Hi @Anonymous ,

 

Not sure what your data table looks like, I created a table like this for testing.

vcgaomsft_0-1648202345294.png

Then please create a measure.

 

Measure = 
VAR _pervious_month = MONTH(TODAY())-1
VAR _current_month = MONTH(TODAY())
VAR _employee_1 = CALCULATE(SUM('Table'[ID]),FILTER('Table','Table'[Month]=_pervious_month))
VAR _employee_2 = CALCULATE(SUM('Table'[ID]),FILTER('Table','Table'[Month]=_current_month))
RETURN
SWITCH(
    TRUE(),
    _employee_1=_employee_2&&_employee_1<>BLANK(),"in-service",
    _employee_1<_employee_2,"New",
    _employee_1>_employee_2,"Leavers"
)

 

vcgaomsft_1-1648202425341.png

If this doesn't work for you or I misunderstand your needs, please consider sharing more details about it. And it would be great if there was a sample file without any sensitive information here.

 

Best Regards,
Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

amitchandak
Super User
Super User

@Anonymous , I think you need very similar what I disucssed here

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.