cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Add column to show joiners and leavers

Dataset table has employee IDs and their full-time equivalent values by months spanning two years in a column. How do I calculate who are new joiners and who are leavers, i.e. to populate columns "Previous month FTE" and "Marker"?

I tried to calculate first previous month FTE using "calculate (sum(FTE), previousmonth (Year Month)", but failed. essentially if I can get the previous month FTE, then the Marker would be a if function of: If previous month FTE is not found, mark as "Joiner", and if previous month FTE is >0 and FTE is not found, then mark as "Leaver". 

Employee IDFTEYear MonthPrevious month FTEMarker
10000112019 JanNANA
1000020.72019 JanNANA
1000030.82019 JanNANA
10000412019 JanNANA
10000512019 JanNANA
10000112019 Feb1 
1000020.72019 Feb0.7Leaver
1000030.82019 Feb0.8 
10000412019 Feb1 
10000512019 Feb1 
10000112019 Mar1 
1000030.82019 Mar0.8 
10000412019 Mar1 
10000512019 Mar1 
10000612019 Mar0Joiner
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Add column to show joiners and leavers

@JCasson 

you can try to create two columns

Column = 
VAR mindate=minx(all('Table'),'Table'[Year Month])
VAR previous=MAXX(FILTER('Table','Table'[Employee ID]=EARLIER('Table'[Employee ID])&&'Table'[Year Month]<EARLIER('Table'[Year Month])),'Table'[FTE])
return if('Table'[Year Month]=mindate,blank(),if(ISBLANK(previous),0,previous))


Column 2 = 
VAR mindate=minx(all('Table'),'Table'[Year Month])
VAR maxdate=MAXX(all('Table'),'Table'[Year Month])
VAR previous=MAXX(FILTER('Table','Table'[Employee ID]=EARLIER('Table'[Employee ID])&&'Table'[Year Month]<EARLIER('Table'[Year Month])),'Table'[FTE])
VAR next=MINX(FILTER('Table','Table'[Employee ID]=EARLIER('Table'[Employee ID])&&'Table'[Year Month]>EARLIER('Table'[Year Month])),'Table'[FTE])
return if(ISBLANK('Table'[Column]),BLANK(),if(ISBLANK(previous),"joiner",if('Table'[Column]>0&&ISBLANK(next)&&'Table'[Year Month]<>maxdate,"leaver",blank())))

1.PNG

Did I answer your question? Mark my post as a solution.Appreciate your Kudos!
Proud a to be a Datanaut!
Thanks and BR
Ryan

View solution in original post

1 REPLY 1
Highlighted
Super User II
Super User II

Re: Add column to show joiners and leavers

@JCasson 

you can try to create two columns

Column = 
VAR mindate=minx(all('Table'),'Table'[Year Month])
VAR previous=MAXX(FILTER('Table','Table'[Employee ID]=EARLIER('Table'[Employee ID])&&'Table'[Year Month]<EARLIER('Table'[Year Month])),'Table'[FTE])
return if('Table'[Year Month]=mindate,blank(),if(ISBLANK(previous),0,previous))


Column 2 = 
VAR mindate=minx(all('Table'),'Table'[Year Month])
VAR maxdate=MAXX(all('Table'),'Table'[Year Month])
VAR previous=MAXX(FILTER('Table','Table'[Employee ID]=EARLIER('Table'[Employee ID])&&'Table'[Year Month]<EARLIER('Table'[Year Month])),'Table'[FTE])
VAR next=MINX(FILTER('Table','Table'[Employee ID]=EARLIER('Table'[Employee ID])&&'Table'[Year Month]>EARLIER('Table'[Year Month])),'Table'[FTE])
return if(ISBLANK('Table'[Column]),BLANK(),if(ISBLANK(previous),"joiner",if('Table'[Column]>0&&ISBLANK(next)&&'Table'[Year Month]<>maxdate,"leaver",blank())))

1.PNG

Did I answer your question? Mark my post as a solution.Appreciate your Kudos!
Proud a to be a Datanaut!
Thanks and BR
Ryan

View solution in original post

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors