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
Artefact
Helper II
Helper II

Running total like YTD, but begin and end on sept 1

Hello,

I think the title says it all! So a DAX command with time intelligence which starts not on jan 1st like YTD but another 1st of a month. And which calculates a running total on a daily basis. And starting again after a full year.

 

Thanks!

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

There is a DAX function DATESYTD which accepts an optional year end date parameter that you could likely use in this scenario.
Here is a link to the learn doc. Learn - DATESYTD 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

6 REPLIES 6
Sahir_Maharaj
Super User
Super User

Hello @Artefact,

 

Can you please try the following approach:

RunningTotalSep1 =
CALCULATE(
    [Total Sales], 
    FILTER(
        ALL('Date'),
        'Date'[Date] >= DATE(YEAR(TODAY()) - IF(MONTH(TODAY()) < 9, 1, 0), 9, 1) &&
        'Date'[Date] <= MAX('Date'[Date])
    )
)

Hope this helps.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
mark_endicott
Super User
Super User

@Artefact - You don't understand. 

 

In DATESYTD( ) think of the end date that you set in the code as setting a static start date. You just give it the day before you want your YTD to start. You are just setting a static end to the previous year.

 

The end date of your current year will then be dynamic when you use a slicer etc.

Artefact
Helper II
Helper II

Thanks, but I want the end date to be dynamic, with a slicer. And the parameter you mentioned must be static.

@Artefact - The solution provided by @jgeddes will be dynamic, because you will set the year end date to 31/08, which will mean your YTD calculation always begins at 01/09 and runs to current date. 

 

An example of how you will use this is below:

 

CALCULATE( [Total Sales], DATESYTD('Date'[Date]', "08-31") )

 You will need to make sure you use the correct format for your Date Locale.

I want the end date to be dynamic, and not limited to one date like 31/08. I want the customer to choose th end date. Based on a parameter or selection.

jgeddes
Super User
Super User

There is a DAX function DATESYTD which accepts an optional year end date parameter that you could likely use in this scenario.
Here is a link to the learn doc. Learn - DATESYTD 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.

Top Solution Authors