Forum Discussion

Diana_Jardim100's avatar
Diana_Jardim100
Frequent Visitor
3 years ago
Solved

Need some help.

Hi everyone. 

Please I need some help.

 

Currently I have a dataset which contains the Headcount of the company by month.

I need to display the total of people that joined and left the company monthly and the total of headcount by month as well.

 

The problem is there are some people that joined the company as a contractor and then became permanent.

So here I have an example:

First as a contractor then as a permanent.

Row Data

In order to display the count of people that joined and left the company monthly I need to figure out how to ignore the last date (04/06/2022) and consider the first date (04/06/2021)

Another thing, I also need to take into account  that in this particular case  they didn’t leave the company so I also can’t count this in leavers.

On the other hand, the are some people that have actually left so I will need to consider the newer date and  discard the oldest.  

 

And finally, I don’t know how to sum the total of the previous month with the current month to have the total of headcount.

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Ok please try 

     

    Summary = SUMMARIZE(TotalActivosSaidas,TotalActivosSaidas[ID_EMPREGAD]"First Start Date"CALCULATE(FIRSTDATE(TotalActivosSaidas[DAT_INI_ACT_EMP]),TotalActivosSaidas[DAT_INI_ACT_EMP] = MAX(TotalActivosSaidas[DAT_INI_ACT_EMP]), "Last day"CALCULATE(LASTDATE(TotalActivosSaidas[DAT_SAID]),TotalActivosSaidas[DAT_SAID] =max(TotalActivosSaidas[DAT_SAID]))))

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    hello Diana_Jardim100  i think a summarized table could help 
    summary of table = summarize(table,[ID_EMPREGAD], "First Start Date",calculate(firstdate(dat_ini_act_emp)FILTER(table,dat_ini_act_emp = max(dat_ini_act_emp)),"Last day",calculate(lastdate(dat_said_one_hr),FILTER(table,dat_said_one_hr = max(dat_said_one_hr))

    • Diana_Jardim100's avatar
      Diana_Jardim100
      Frequent Visitor

      First Many thanks.

      I'm almost there 🙂

      I don't know what I'm doing wrong but it has return this message.

      The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column.

       

      Summary = SUMMARIZE(TotalActivosSaidas,TotalActivosSaidas[ID_EMPREGAD], "First Start Date", CALCULATE(FIRSTDATE(TotalActivosSaidas[DAT_INI_ACT_EMP]),FILTER(TotalActivosSaidas,TotalActivosSaidas[DAT_INI_ACT_EMP] = MAX(TotalActivosSaidas[DAT_INI_ACT_EMP])), "Last day", CALCULATE(LASTDATE(TotalActivosSaidas[DAT_SAID]),FILTER(TotalActivosSaidas,TotalActivosSaidas[DAT_SAID] =max(TotalActivosSaidas[DAT_SAID])))))

       

       

       

       

       

       

       

       

       

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Ok please try 

         

        Summary = SUMMARIZE(TotalActivosSaidas,TotalActivosSaidas[ID_EMPREGAD]"First Start Date"CALCULATE(FIRSTDATE(TotalActivosSaidas[DAT_INI_ACT_EMP]),TotalActivosSaidas[DAT_INI_ACT_EMP] = MAX(TotalActivosSaidas[DAT_INI_ACT_EMP]), "Last day"CALCULATE(LASTDATE(TotalActivosSaidas[DAT_SAID]),TotalActivosSaidas[DAT_SAID] =max(TotalActivosSaidas[DAT_SAID]))))

  • Hi Diana_Jardim100 ,

     

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

     

    Refer to:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

     

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.