Forum Discussion

xichiza's avatar
xichiza
Frequent Visitor
4 years ago
Solved

HELP - Cumulative count for latest value (string)

Hi Everyone,

 

I am struggling with a issue even if I feel like it is not that complicated. I need to get the cumulative count of latest grade for employees.

 

January : If employee A gets Grade A and employee B and employee C get Grade B -> Total A : 1 and Total B : 2

February : if Employee B gets Grade A -> Total A : 2 and Total B : 1 

 

Here is a more detail exemple : 

 

EmployeeDateMonthGrade
E101/01/20211A
E204/01/20211B
E303/02/20212A
E412/02/20212B
E518/02/20212C
E503/03/20213A
E703/03/20213A
E819/03/20213A
E901/04/20214A
E403/04/20214A

 

Results expected : 

 

MonthTOTAL ATOTAL BTOTAL C
11  
111 
221 
222 
2221
332 
342 
352 
462 
471 

 

Thanks in advance for helping me with this case!

  • Please try to create three similar measures.

    Total A = CALCULATE(COUNTX(FILTER(ALLSELECTED('Table'),'Table'[Month]<=MAX('Table'[Month])&&'Table'[Grade]="A"),'Table'[Employee]))

     

4 Replies

  • xichiza , Add index column to the table.

     

    Add month and index column on row of matrix

    Grade on column of matrix

     

    and this measure on value

     

    countx(allseleceted(Table), Table[Month]<=Table[Month] && Table[Grade] = Max(Table[Grade]) , Table[employee])

    • xichiza's avatar
      xichiza
      Frequent Visitor

      Hi amitchandak , thanks for answering. 

       

      I have tried the formula but I am getting an error. Please see attached the pbix I used and formula error.

       

      https://we.tl/t-SlxT8ZSD1l 

       

      Also to clarify what I need at the end : 

       

       

       

      thanks for your help

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

    Please try to create three similar measures.

    Total A = CALCULATE(COUNTX(FILTER(ALLSELECTED('Table'),'Table'[Month]<=MAX('Table'[Month])&&'Table'[Grade]="A"),'Table'[Employee]))