Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
xichiza
Frequent Visitor

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!

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
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]))

Vlianlmsft_0-1633933840183.png

 

View solution in original post

4 REPLIES 4
V-lianl-msft
Community Support
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]))

Vlianlmsft_0-1633933840183.png

 

xichiza
Frequent Visitor

@amitchandak any update on your end ? Don't know if it is understable .. Let me know ! thanks 

amitchandak
Super User
Super User

@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])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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 : 

 

test.png

 

 

thanks for your help

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors