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
jthomson
Solution Sage
Solution Sage

Stopping a cumulative sum at the last data point

Hi,

 

Sample data looks something like this:

 

StartPeriodCancellationTiming
A1
A1
A2
A3
A 
A6
A 
A 
A10
A 
B1
B1
B1
B3
B7
B 
B 
B 
B 
B 
C1
C2
C2
C4
C5
C 
C 
C 
C 
C 

 

What I need to do is create a count of the number of entries in the CancellationTiming column and plot them against an x-axis running from 1-12, with the y-axis indicating the count of rows which have a timing less than or equal to each relevant x-axis point and (this is what I'm having trouble with) have the line stop at the last point at which there is an entry. So something like this is the desired end product:

 

jthomson_0-1715855650815.png

I have the x-axis on a separate table (just a list of numbers from 1-12), and the DAX measure I'm using is this:

 

CumulativeCancellations = 

var stoppoint = max([CancellationTiming])

var nullpoint = if(stoppoint = max(MonthTable[MonthNumber]), blank(), 2)

return min (nullpoint, calculate(countrows(MainTable), MainTable[CancellationTiming]<>blank(), MainTable[CancellationTiming]<=max(MonthTable[MonthNumber])))

 

However that just runs the line all the way from 1-12 and ignores the attempted logic telling it to stop. What am I doing wrong?

2 REPLIES 2
Anonymous
Not applicable

Hi @jthomson ,

 

Seems a bit strange, what field is MonthTable[MonthNumber] in the formula you provided?

 

Best Regards,
Adamk Kong

 

It's an unconnected table containing the numbers 1-12.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors