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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
keckraguilar
Frequent Visitor

Dynamic YTD Formula (DAX)

 

I have two tables, budget and sales. I want to create a dynamic ytd budget formula that only sums the data through the max month in the sales table. I already converted the month name to numbers. (not shown) Basically the current snapshot would sum the budget through February, and when I load the data for the next month (march) the formula will automatically update to sum the budget through march. 

 

 

keckraguilar_1-1714686819165.png

 

 

1 ACCEPTED SOLUTION

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1715152577861.png

 


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

View solution in original post

13 REPLIES 13
Ashish_Mathur
Super User
Super User

Hi,

Why is there no Year column?  Is the FY from July - June?  Share data in a format that can be pasted in an MS Excel file.


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

How do I share an excel doc on here?

Upload it to Google Docs and share the download link.  Please also answer the questions asked in my earlier message.


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

Here you go. The google doc has additional fields. and yes FY months are July-June

 

https://docs.google.com/spreadsheets/d/1ACn_70cU0GS1_FO-FAt8LFdDLfbz4TsWfYyYOAWpUJM/edit?usp=sharing

 

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1715152577861.png

 


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

There should also be an year column in there.  I cannot take the year from FY2024 because this FY will also include months from the previous CY.  So have a year column as well.


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

I think that is fine because the budget tab will always only have one Fiscal Year and no previous years

That isn't the point.  I will need that column in order to create a Date field.  This in turn will allow me to create a Calendar table.


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

OK, but the sales tab is an aggregate of the month. Also, the budget tab is the budget for the month because there is no daily budget. I suppose I can create a date field with the same day of the month if you believe that will work?

Do not bother about creating a Date column - i will create that.  I just need 2 columns in each table - Year and Month name.


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

OK I just added the year column. Month was already in the file

danextian
Super User
Super User

Hi @keckraguilar 

Please try this:

Dynamic Budget YTD =
VAR MaxMonthInSales =
    CALCULATE ( MAX ( sales[month number] ), ALL ( sales ) )
RETURN
    CALCULATE (
        SUM ( budget[amount] ),
        FILTER ( ALL ( budget ), budget[month] <= MaxMonthInSales )
    )




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

thanks for the resonse! the formula doesn't seem to be working. it is showing an inlfated number, not sure if it is still summing all months in the budget file?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.