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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Running total at the end off each month

Hi,

I would like to create 12 measures for the 12 months of this year in which I calculate a running total up to each end of the months.

For now I'm using this type of formula, but I would like to make it more general (not only for this year, but also for years to come):

EXAMPLE FOR JANUARY:

SP_Net amount prog Mar = 
CALCULATE([SP_Net amount],
        'D - Date'[Date] >= DATE ( 2021, 1, 1 ) &&
        'D - Date'[Date] <= DATE ( 2021, 3, 31 ))
So I ask you if there is a function in order to calculate the last date of each months giving me examples (I know there is ENDOFMONTH but I don't understand if it is right in this case and how to use in this case (please, use my example)

 

3 REPLIES 3
ERD
Community Champion
Community Champion

Hi @Anonymous ,

I'm not sure I've understood correctly what you need, but have a look at this measure:

 

#amt = 
var monthEnd = ENDOFMONTH('Date'[Date])
var currentYear = SELECTEDVALUE('Date'[Year])
var result = CALCULATE(
    [#fruits],
    'Date'[Date] < monthEnd,
    'Date'[Year] = currentYear
)
return
result

 

ERD_0-1620394953569.png

 

If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I am not sure I understood your question correctly, but please try using DATESMTD or TOTALMTD function.

Something like below.

 

SP_Net amount prog Mar =
TOTALMTD ( 'D - Date'[Date], [SP_Net amount] )

 

If you can share your sample pbix file's link, then I can try to understand why you needed to write your measure like above, then I can try to come up with a more accurate measure.

 

Thanks.

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM



Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



Anonymous
Not applicable

I give an example:

On january I have 2 apples, on february 1 apple, on march 8 apple. So:

JANUARY FORMULA RESULT=2

FEBRUARY FORMULA RESULT= 1 + 2 =3

MARCH FORMULA RESULT= 1 + 2 + 8 = 11

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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