Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Count Employee allocations

I have allocation records, where an employee is allocated to various clients & the employee works at diff departments within the client, employees may be rotated or extended to another task within the client for some other department

Please refer below sample records
i.e. CHARANI is allocated to Godrej on 11 march to 31st Dec
i.e. Chaumel is allocated to LG on 15-March 21 (New Allocation), but again on 4-June-21 she is allocated to another department, since it is "Extension"

 

Sample Data:

EmpIDEmployee NameClientDepartmentStart DateEnd DateStatus
791CHAARANIGodrejSales11-Mar-2131-Dec-21New Allocation
530CHAUMELLGMarketing15-Mar-212-Dec-21New Allocation
530CHAUMELLGProduction4-Jun-211-Apr-22Extension
530CHAUMELGodrejAccount4-Apr-224-Dec-22New Allocation
445VIGANPanasonicSales2-Feb-211-Mar-21New Allocation
445VIGANPanasonicSales3-Mar-2118-Mar-21Extension
445VIGANPanasonicMarketing22-Mar-211-Apr-21Extension
445VIGANLGSales4-Apr-2112-May-22New Allocation
875GORTAISPanasonicProduction17-May-2131-Dec-21New Allocation

 

Problem Statement
Count "New Allocations" & "Extensions"


Notes:
1. If there is a single record in this sheet this means it is "New Allocation"
2. if there are multiple records of a same person, but the client name is same, the entry on the MIN(startdate) is considered "New Allocation" & rest are "Extensions"
3. if there are multiple records of a same person, every time employee is allocated to a new client, the entry on the MIN(startdate) is considered "New Allocation" & rest are "Extensions"

 

Output

New allocations6
Extensions3
  • Try to create a new column like below:

    status_1 = 
     var rank_ = 
     RANKX(
         FILTER('Table',
            EARLIER('Table'[EmpID])='Table'[EmpID]&&
            'Table'[Client]=EARLIER('Table'[Client])
        ),
        'Table'[Start Date],,ASC,Dense)
    return IF(rank_=1,"New Allocation
    ","Extension")

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Note: in Base records the status column is not there, I am looking to create that column, 

    I tried using group by EmpID, got the count of entries for each emp but I am clueless what to do next, please help

    • V-lianl-msft's avatar
      V-lianl-msft
      Community Support

      Try to create a new column like below:

      status_1 = 
       var rank_ = 
       RANKX(
           FILTER('Table',
              EARLIER('Table'[EmpID])='Table'[EmpID]&&
              'Table'[Client]=EARLIER('Table'[Client])
          ),
          'Table'[Start Date],,ASC,Dense)
      return IF(rank_=1,"New Allocation
      ","Extension")