Forum Discussion
Cumulative measure missing a row in its count.
- 1 year ago
Hi BarnyQuack ,
The issue is that your cumulative measure depends on rows existing for each combination of bucket and name. When there’s no row for a specific name in a bucket—like when “B” doesn’t appear in the “Today” bucket—Power BI doesn’t fill in that gap, and your cumulative measure undercounts. Specifically, your measure uses ALLSELECTED('Table'), but if there's no data point for that combination, it silently disappears from the visual, and the cumulative logic skips it.
Your Count rows of Status and buckets measure adds [AllCount] + [CurrentlyY], but [AllCount] only counts visible rows, and when a name has no row in a bucket (like “Today” for B), it doesn’t get counted at all. The cumulative DAX:
Cumulative for Status and bucket = VAR CurrentSort = MAX('Table'[Sort Code]) RETURN CALCULATE( [Count rows of Status and buckets], FILTER( ALLSELECTED('Table'), 'Table'[Sort Code] <= CurrentSort ) )only includes rows that are physically present. So when you're not slicing by Name, and one name is missing for a bucket, Power BI doesn’t create that row, and the count is off. That’s why adding a dummy “Today” row for B fixes it—because now there’s a data point to anchor the cumulative calc for that name.
To fix it properly without dummy rows, you’d need to restructure your model to include all combinations using a disconnected scaffold table of [Bucket] x [Name]. Then, join that to your fact table and use that scaffold in your visuals. That way, every combo exists, and your DAX can properly accumulate over time. Otherwise, it’s like trying to total sales per store when some stores don’t report that day—your total looks wrong just because silence isn’t zero, it’s just missing.
Best regards,
Hi BarnyQuack ,
The issue is that your cumulative measure depends on rows existing for each combination of bucket and name. When there’s no row for a specific name in a bucket—like when “B” doesn’t appear in the “Today” bucket—Power BI doesn’t fill in that gap, and your cumulative measure undercounts. Specifically, your measure uses ALLSELECTED('Table'), but if there's no data point for that combination, it silently disappears from the visual, and the cumulative logic skips it.
Your Count rows of Status and buckets measure adds [AllCount] + [CurrentlyY], but [AllCount] only counts visible rows, and when a name has no row in a bucket (like “Today” for B), it doesn’t get counted at all. The cumulative DAX:
Cumulative for Status and bucket =
VAR CurrentSort = MAX('Table'[Sort Code])
RETURN
CALCULATE(
[Count rows of Status and buckets],
FILTER(
ALLSELECTED('Table'),
'Table'[Sort Code] <= CurrentSort
)
)
only includes rows that are physically present. So when you're not slicing by Name, and one name is missing for a bucket, Power BI doesn’t create that row, and the count is off. That’s why adding a dummy “Today” row for B fixes it—because now there’s a data point to anchor the cumulative calc for that name.
To fix it properly without dummy rows, you’d need to restructure your model to include all combinations using a disconnected scaffold table of [Bucket] x [Name]. Then, join that to your fact table and use that scaffold in your visuals. That way, every combo exists, and your DAX can properly accumulate over time. Otherwise, it’s like trying to total sales per store when some stores don’t report that day—your total looks wrong just because silence isn’t zero, it’s just missing.
Best regards,
Hi DataNinja777
That worked a treat! Really appreciate that - you're a star!
It inititially didn't work as it was bad data.