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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
anom
Frequent Visitor

Cumulative sum for all month until today even if a value with a month does not exist in the dataset

Hi,

 

I would like to show cumulative sum for all month until current month in a table visual or a line chart but the data might have some months missing and I would still like to show them in the visuals.

 

For example, a sample data could be like below,

anom_1-1692570566085.png

Here you can see there are no data for April and no data after June, but in PowerBI, I would still like to show cumulatives for those months, something like below,

anom_2-1692570666597.png

Thank you.

8 REPLIES 8
parry2k
Super User
Super User

@anom As a best practice, add a date dimension in your model and use it for time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools. Check the related videos on my YT channel

 

Add Date Dimension
Importance of Date Dimension
Time Intelligence Playlist

 

Now add the following measure  for cumulative total until the last transaction date (you can tweak it whatever you want) to make it work:

 

RT Sales = 
VAR MaxSalesDate = CALCULATE ( MAX ( 'Calendar'[Date] ), Sales )
VAR RT =
CALCULATE ( 
    [Sales],
    FILTER ( 
        ALLSELECTED ( 'Calendar'[Date] ),
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) &&
        'Calendar'[Date] <= MaxSalesDate
    )
)
RETURN RT

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Ashish_Mathur
Super User
Super User

Hi,

Ensure that you have a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name by the Month number.  To your visual, drag Year and Month name from the Calendar Table.  Write these measures

Total = sum(Data[Sales])

Total YTD = calculate([Total],datesytd(calendar[date],"31/12"))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, ytd resets running total for a new year, need the running total to continue as data will have many years. Thank you

Revise the YTD measure to

Total YTD = calculate([Total],datesbetween(calendar[date],minx(all(calendar),calendar[date]),max(calendar[date])))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, this is showing running total for every single day/month for the date table. Is it possible to show for a specific date range?? (I will need to have a larger date range for date table for real use case and can not show the running total for every single one)

anom_0-1692656505765.png

anom_1-1692656553130.png

 

For example, I want to show only upto current month. There might be more lines with different date ranges but would like this line to be just until today. Thank you.

Expand the filter pane and apply a date filter.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
parry2k
Super User
Super User

@anom do you have a date dimension in your model? What is your running total measure look like?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

anom
Frequent Visitor

cumulative_amount =

CALCULATE(
    [sum_amount],

    FILTER(
        ALLSELECTED(Data),
        Data[Date] <= MAX(Data[Date])
))

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.