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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Johonnatan
Helper I
Helper I

Matrix with previous calculation

Hi there

 

I am currently working on a solution that needs to sum activities hours per user and makes a calculation based on static expected hour. Basically, a user can work in different activities and will be expected see a subtotal subtracting from expected hour on a decreasing scale.

 

In this example, you can find a data sample.

 

Johonnatan_0-1687877455733.png

For Jsilva, I expected see on total column:

 

#1 line - Hours - Expected = 10 - 1 = 9

#2 line - Hours - Expected = 9 (previous calculation) - 3 = 6

#3 line - Hours - Expected = 6 (previous calculation) - 4 = 2

 

Is there a way to do that?

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Johonnatan ,

 

Please try:

First create an index column:

vjianbolimsft_0-1688008367906.png

Then apply the measure:

Measure = SELECTEDVALUE('Table'[Expected])-SUMX(FILTER(ALL('Table'),[Index]<=SELECTEDVALUE('Table'[Index])&&[User]=SELECTEDVALUE('Table'[User])),[Hours])

Final output:

vjianbolimsft_1-1688008675388.png

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.

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @Johonnatan ,

 

Please try:

First create an index column:

vjianbolimsft_0-1688008367906.png

Then apply the measure:

Measure = SELECTEDVALUE('Table'[Expected])-SUMX(FILTER(ALL('Table'),[Index]<=SELECTEDVALUE('Table'[Index])&&[User]=SELECTEDVALUE('Table'[User])),[Hours])

Final output:

vjianbolimsft_1-1688008675388.png

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.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.