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
Charuta
Frequent Visitor

Cumulative Running Count - Trend Line Graph

Hello,

Need help - For a cumulative trend line chart - open vs closed tickets. doing a running count using this formula - 

Running Total = CALCULATE((count(Data[ticketcount])),Filter(All(Data[createddate]),Data[createddate]<=Max(Data[createddate])) )
 

Where there is blank, it should be showing previous month data. For example, for the month of May there is no ticket Closed, we need to show same count as what is seen in April. Closed line is breaking and not showing any data for May.

Charuta_0-1622112257891.png

 

I tried using Calendar table, but unable to get the right output. When there is no data for the month, the line breaks in between.  

 

Any suggestions for this?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Charuta , Have you tried like with date table

for active join created date

Running Total = CALCULATE((count(Data[ticketcount])),Filter(All(Date[Date]),Date[Date]<=Max(Date[Date])) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Charuta ,

 

According to my understanding, when there is no data in this month, then use the count number of previous month,right?

 

Please firstly create a new calendar table and build a relationship between two tables:

Calendar = CALENDAR(MIN('Data'[CreatedDate]),MAX('Data'[CreatedDate]))

build relationship.jpg

Then use the following formula to create a measure:

Measure = 
var _count=CALCULATE(COUNT(Data[TicketCount]),FILTER('Data', FORMAT([CreatedDate],"YYYY-MM")=FORMAT(MAX('Calendar'[Date]),"YYYY-MM"))) 
return IF(_count=BLANK(),CALCULATE(COUNT(Data[TicketCount]),PREVIOUSMONTH('Calendar'[Date])),_count)

The final output is shown below:

previous count.jpg

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks both , @Anonymous and @amitchandak - Calendar date option worked, the format was date/time earlier so it wasn't working. Now it is all fixed

amitchandak
Super User
Super User

@Charuta , Have you tried like with date table

for active join created date

Running Total = CALCULATE((count(Data[ticketcount])),Filter(All(Date[Date]),Date[Date]<=Max(Date[Date])) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit,

Yes, I have tried this. It does not give the increasing trend and no data for the next month. still shows blank.

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.