Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Problems with SUMX

Hi, i am trying to accumulate the results of the following measure:

ind_rotacion =
   VAR rota_colab =
      SUM(Sheet1[ROTACION])
   VAR totalcolaborador=
      COUNT(Sheet1[Contrato])
RETURN
   DIVIDE(rota_colab,totalcolaborador)
 
I am using a SUMX function as follows:
rotacion_acum = SUMX(FILTER(ALLSELECTED(Sheet1),Sheet1[Mes]<=MAX(Sheet1[Mes])),[ind_rotacion])
 
i have a database with the information of the active employees during each month and a colum with a 1 or a 0 if they quit or not (Sheet1[ROTACION])
 
The results i get from the sumx function, equals the accumulated sum of the monthly rotation Sheet1[ROTACION] even though the expression i used is [ind_rotacion] 
rotation rate = [ind_rotacion] 
the result i get = rotacion_acum = SUMX(FILTER(ALLSELECTED(Sheet1),Sheet1[Mes]<=MAX(Sheet1[Mes])),[ind_rotacion])
Thank you so much for your help in advance! Can I accumulate a measure?  

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    Refer the formula.

    Measure = SUMX(FILTER(ALLSELECTED(sheet1[Mes]),sheet1[Mes]<=MAX(sheet1[Mes])),[ind_rotacion])

     

    Best Regards,

    Jay

5 Replies

  • Anonymous , Can you share sample data and sample output in table format? with based columns

     

    try like

    divide( SUMX(FILTER(ALLSELECTED(Sheet1),Sheet1[Mes]<=MAX(Sheet1[Mes])),Sheet1[ROTACION]) ,

    COUNTX(FILTER(ALLSELECTED(Sheet1),Sheet1[Mes]<=MAX(Sheet1[Mes])),Sheet1[Contrato]))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much for the quick response. I tryed the DAX fuction and it gave me zero. I think in there we would be acumulating the number of employees that quit divided by the monthly count of the employees. But i need to acumulate the result of that division. Sadly i cannot share an exact data sample, but i made one. 

      AnioMescod_mesContratoNombreIdentificacionROTACIONfecha_mensual
      2021120211566687901peter parker11111111101/01/2021
      2021220212566687901peter parker11111111101/02/2021
      2021320213566687901peter parker11111111101/03/2021
      2021420214566687901peter parker11111111101/04/2021
      2021520215566687901peter parker11111111101/05/2021
      2021620216566687901peter parker11111111111/06/2021
      202112021177889011samantha jhonson22222222201/01/2021
      202122021277889011samantha jhonson22222222201/02/2021
      202132021377889011samantha jhonson22222222201/03/2021
      202142021477889011samantha jhonson22222222201/04/2021
      202152021577889011samantha jhonson22222222201/05/2021
      202162021677889011samantha jhonson22222222201/06/2021
      202112021133300011peter parker33333333301/01/2021
      202122021233300011peter parker33333333311/02/2021
      202112021188888888john doe4444444401/01/2021
      202122021288888888john doe4444444401/02/2021
      202132021388888888john doe4444444401/03/2021
      202142021488888888john doe4444444401/04/2021
      202152021588888888john doe4444444401/05/2021
      202162021688888888john doe4444444401/06/2021
      202112021176514238john doe5555555501/01/2021
      202122021276514238john doe5555555501/02/2021
      202132021376514238john doe5555555501/03/2021
      202142021476514238john doe5555555501/04/2021
      202152021576514238john doe5555555511/05/2021

       

      this is kinda what i have the total of employees varies each month and i have a dummy column with a 1 in the month they rotated so i sum those ones and count the total of contracts and then i divide it getting the ind_rotation measure. In the report i created a table and added the month, the sum of the rotation, the count of the contracts and the ind_rotation measure and it gaves me the monthly indicator which i need to accumulate 

      I need another measure to acummulates the ind_rotation in order to add it to the table. also i need it to be this way cuz i need to filter by zone and management office 

      count of contractssum of rotationind_rotationacum ind_rotation
      1277151,17%1,17%
      1322181,36%2,54%
      1332241,80%4,34%
      1331312,33%6,67%
      1363211,54%8,21%
      1371120,88%9,08%

       

      Again, thank you so much for your help 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much for the quick response. I tryed the DAX fuction and it gave me zero. I think in there we would be acumulating the number of employees that quit divided by the monthly count of the employees. But i need to acumulate the result of that division. Sadly i cannot share an exact data sample, but i made one. 

      AnioMescod_mesContratoNombreIdentificacionROTACIONfecha_mensual
      2021120211566687901peter parker11111111101/01/2021
      2021220212566687901peter parker11111111101/02/2021
      2021320213566687901peter parker11111111101/03/2021
      2021420214566687901peter parker11111111101/04/2021
      2021520215566687901peter parker11111111101/05/2021
      2021620216566687901peter parker11111111111/06/2021
      202112021177889011samantha jhonson22222222201/01/2021
      202122021277889011samantha jhonson22222222201/02/2021
      202132021377889011samantha jhonson22222222201/03/2021
      202142021477889011samantha jhonson22222222201/04/2021
      202152021577889011samantha jhonson22222222201/05/2021
      202162021677889011samantha jhonson22222222201/06/2021
      202112021133300011peter parker33333333301/01/2021
      202122021233300011peter parker33333333311/02/2021
      202112021188888888john doe4444444401/01/2021
      202122021288888888john doe4444444401/02/2021
      202132021388888888john doe4444444401/03/2021
      202142021488888888john doe4444444401/04/2021
      202152021588888888john doe4444444401/05/2021
      202162021688888888john doe4444444401/06/2021
      202112021176514238john doe5555555501/01/2021
      202122021276514238john doe5555555501/02/2021
      202132021376514238john doe5555555501/03/2021
      202142021476514238john doe5555555501/04/2021
      202152021576514238john doe5555555511/05/2021

      this is kinda what i have the total of employees varies each month and i have a dummy column with a 1 in the month they rotated so i sum those ones and count the total of contracts and then i divide it getting the ind_rotation measure. In a table an add the month the sum of the rotation, the count of the contracts and the ind_rotation measure and it gaves me the monthly indicator which i need to accumulate 

      I need another measure to acummulates the ind_rotation in order to add it to the table. also i need it to be this way cuz i need to filter by zone and management office

      This would be the output table

      count of contractssum of rotationind_rotationaccum ind_rotation
      1277151,17%1,17%
      1322181,36%2,54%
      1332241,80%4,34%
      1331312,33%6,67%
      1363211,54%8,21%
      1371120,88%9,08%

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Refer the formula.

    Measure = SUMX(FILTER(ALLSELECTED(sheet1[Mes]),sheet1[Mes]<=MAX(sheet1[Mes])),[ind_rotacion])

     

    Best Regards,

    Jay

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much Jay, i've been looking for this answer quite some time now. it worked!! Would you please explain me the difference between filter by Sheet1 and filter by Sheet1[month]. It made a difference in the result