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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.