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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors