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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Super User
Super User

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

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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