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

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

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

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.