Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am having issues with calculating a running total by group (sex) in a matrix. My table is an attendance sheet so I just need to calculate the running total of the number of rows (attendants) for each year. I made a calculated measure and it worked fine for the column chart. Here is the code and the chart:
Running Total by Sex =
CALCULATE(
COUNTROWS('tbl1'),
FILTER(
ALL('tbl1'),
'tbl1'[Date] <= MAX('tbl1'[Date]) &&
'tbl1'[Sex] = MAX('tbl1'[Sex])
)
)But when I converted it to a matrix, the total doesn't seem to add up properly. I put [Sex] as rows, [Date] (hierarchy) as columns and the Running Total by Sex measure as the Values. What am I doing wrong?
Thanks in advance...
Solved! Go to Solution.
@Anonymous ,
Sorry, try this
Running Total by Sex =
CALCULATE(
COUNTROWS('tbl1'),
FILTER(
ALLEXCEPT('tbl1', 'tbl1'[Sex]),
'tbl1'[Date] <= MAX('tbl1'[Date])
)
)Regards,
Mariusz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Try the below.
Running Total by Sex =
CALCULATE(
COUNTROWS('tbl1'),
FILTER(
ALLEXCEPT('tbl1', 'tbl1'[Sex]),
'tbl1'[Date] <= MAX('tbl1'[Date]) &&
)
)
Regards,
Mariusz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Mariusz ,
That worked! Thanks!
Running Total by Sex =
CALCULATE(
COUNTROWS('tbl1'),
FILTER(
ALLEXCEPT('tbl1', 'tbl1'[Sex]),
'tbl1'[Date] <= MAX('tbl1'[Date])
)
)@Anonymous : Thanks for your help. Problem solved...
@Anonymous ,
Sorry, try this
Running Total by Sex =
CALCULATE(
COUNTROWS('tbl1'),
FILTER(
ALLEXCEPT('tbl1', 'tbl1'[Sex]),
'tbl1'[Date] <= MAX('tbl1'[Date])
)
)Regards,
Mariusz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Just create the measure
RunningTotal = COUNTROWS('tbl1')
Try it out and let me know.
Cheers
CheenuSing
Hi @Anonymous ,
Thanks but it didn't work
. I get just a regular total instead of a running total now...
Hi @Anonymous ,
Can you share the pbix in Google Drive or OneDrive and paste the link here to check and suggest.
Cheers
CheenuSing
Hi @Anonymous ,
Sure. I can't seem to share outside of my organization so give me a moment to figure out how to share this externally...
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |