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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CEllis
Resolver I
Resolver I

Matrix - Reset Cumulation

I've been restling with this for a few days now and cant seem to get it right.

 

I am using a dax statment to provide a cummulation figure in a matrix that works.

 

CALCULATE(SUM('Attendance (Table)'[Present]),
    FILTER(
            ALL('Academic Year (Table)'),
             'Academic Year (Table)'[Week Ending]<= MAX('Academic Year (Table)'[Week Ending])))

 

CEllis_1-1736435874589.png

 

The next step was to  - Check to see
if the Total Marks = Present then continue 

 

CALCULATE(SUM('Attendance (Table)'[Present]),
FILTER(
ALL('Academic Year (Table)'),
'Academic Year (Table)'[Week Ending]<= MAX('Academic Year (Table)'[Week Ending])))


Then to check if they had reached the threshold 

 

if the Cumulation reached 21 then reset the Cumulation to 0

 

Any help greatly appreciated.

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

I don't fully understand what you're trying to do but you could try using MOD.

VAR _Present =
    CALCULATE (
        SUM ( 'Attendance (Table)'[Present] ),
        FILTER (
            ALL ( 'Academic Year (Table)' ),
            'Academic Year (Table)'[Week Ending]
                <= MAX ( 'Academic Year (Table)'[Week Ending] )
        )
    )
RETURN
    MOD ( _Present, 21 )

 

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

I don't fully understand what you're trying to do but you could try using MOD.

VAR _Present =
    CALCULATE (
        SUM ( 'Attendance (Table)'[Present] ),
        FILTER (
            ALL ( 'Academic Year (Table)' ),
            'Academic Year (Table)'[Week Ending]
                <= MAX ( 'Academic Year (Table)'[Week Ending] )
        )
    )
RETURN
    MOD ( _Present, 21 )

 

@AlexisOlson Thanks for the respone.

 

The outcome I am looking for is to flag at the point it hits 21 and then continue the count from 0 to see whn the next 21 occures.

 

I do appreciate your help with this.

 

Week Ending  Fri 06 Sep  Fri 13 Sep  Fri 20 Sep  Fri 27 Sep  Fri 04 Oct  Fri 11 Oct  Fri 18 Oct
AnonTotal MarksPresentCumulativeTotal MarksPresentCumulativeTotal MarksPresentCumulativeTotal MarksPresentCumulativeTotal MarksPresentCumulativeTotal MarksPresentCumulativeTotal MarksPresentCumulative
Pupil 8972860101010104088810801010101080
Pupil 90788601010101010208001000101010101020
   if Total Marks = Present Sum(Present) else 0 or  if Total Marks = Present Sum(Present) else 0 or  if Total Marks = Present Sum(Present) else 0 or  if Total Marks = Present Sum(Present) else 0 or  if Total Marks = Present Sum(Present) else 0 or  if Total Marks = Present Sum(Present) else 0 or  if Total Marks = Present Sum(Present) else 0 or
   if Total Marks =21 then 21  if Total Marks =21 then 21  if Total Marks =21 then 21  if Total Marks =21 then 21  if Total Marks =21 then 21  if Total Marks =21 then 21  if Total Marks =21 then 21

 

 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.