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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Adams_Apple
Frequent Visitor

Using a single budget value for every day of the month

I have a monthly budget table where the data is stored in Date rows with the date being the 1st of each month (1/1/2025, 2/1/2025, etc). I am trying to build out a MTD table that should total running costs next to total running budget, so I can see where the overlap happens every month.

 

I have the cost MTD dialed in, but i cant seem to figure out how to filter a budget measure so that it ignores the fact that the budget value is only stored on the 1st.
ideally, this measure would take the (month budget / total days in month) * days in the month up to that current date.

 

help is appreciated!!!

 

Adams_Apple_0-1743783308560.png

 

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @Adams_Apple  - can you try the below measure:

 

Labor Amount MTD Budget =
VAR CurrentDate = MAX('YourTable'[Date])
VAR MonthStart = EOMONTH(CurrentDate, -1) + 1
VAR MonthBudget = CALCULATE(
SUM('BudgetTable'[BudgetAmount]),
'BudgetTable'[Date] = MonthStart
)
VAR DaysInMonth = DAY(EOMONTH(CurrentDate, 0))
VAR DaysElapsed = DATEDIFF(MonthStart, CurrentDate, DAY)

RETURN
IF(
MonthBudget > 0,
(MonthBudget / DaysInMonth) * DaysElapsed
)

 

 





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

Proud to be a Super User!





View solution in original post

danextian
Super User
Super User

Hi @Adams_Apple 

 

The simplest solution is to split your monthly budget into several rows based on the number of days in a month in the query editor.

danextian_0-1743856659977.png

If that isn't feasible, you can utilize DAX.

MTD (daily x day of month) = 
VAR _NumberOfDays =
    DAY ( CALCULATE ( MAX ( Dates[Date] ), ALLEXCEPT ( Dates, Dates[YYYYMM] ) ) )
VAR _Daily =
    DIVIDE (
        CALCULATE (
            SUM ( Budget2[Budget] ),
            TREATAS ( VALUES ( Dates[Start of Month] ), Budget2[Month] )
        ),
        _NumberOfDays
    )
RETURN
    _Daily * DAY ( MAX ( Dates[Date] ) )

danextian_2-1743857618219.png

 

Please see the attached sample pbix.

 





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.

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.  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/
v-dineshya
Community Support
Community Support

Hi @Adams_Apple ,

Thanks for reaching out to the Microsoft fabric community forum. 

 

DAX code:

MTD Budget =
VAR CurrentDate = MAX('Date'[Date])
VAR MonthStart = DATE(YEAR(CurrentDate), MONTH(CurrentDate), 1)
VAR DaysInMonth = DAY(EOMONTH(CurrentDate, 0))
VAR DaysUpToCurrent = DAY(CurrentDate)
VAR MonthlyBudget =
CALCULATE(
SUM('Budget'[BudgetAmount]),
FILTER('Date', 'Date'[Date] = MonthStart)
)
RETURN
(MonthlyBudget / DaysInMonth) * DaysUpToCurrent

 

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

 

Hi @Adams_Apple ,

Thanks for reaching out to the Microsoft fabric community forum. 

 

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

Hi @Adams_Apple ,

Thanks for reaching out to the Microsoft fabric community forum. 

 

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

Hi @Adams_Apple ,

Thanks for reaching out to the Microsoft fabric community forum. 

 

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

danextian
Super User
Super User

Hi @Adams_Apple 

 

The simplest solution is to split your monthly budget into several rows based on the number of days in a month in the query editor.

danextian_0-1743856659977.png

If that isn't feasible, you can utilize DAX.

MTD (daily x day of month) = 
VAR _NumberOfDays =
    DAY ( CALCULATE ( MAX ( Dates[Date] ), ALLEXCEPT ( Dates, Dates[YYYYMM] ) ) )
VAR _Daily =
    DIVIDE (
        CALCULATE (
            SUM ( Budget2[Budget] ),
            TREATAS ( VALUES ( Dates[Start of Month] ), Budget2[Month] )
        ),
        _NumberOfDays
    )
RETURN
    _Daily * DAY ( MAX ( Dates[Date] ) )

danextian_2-1743857618219.png

 

Please see the attached sample pbix.

 





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

Hi @Adams_Apple ,
To create a proper MTD budget measure in Power BI when your budget values are stored only on the first day of each month, you’ll need to dynamically distribute that monthly value across each day of the month and calculate a cumulative total based on the current date in your visual. This approach allows you to compare daily running actual costs against a growing budget line that reflects a proportional share of the monthly budget. 

 

Since your budget table only contains one entry per month (dated the 1st), the DAX measure needs to locate that monthly value, determine how many days are in the current month, and multiply the daily allocation by the current day of the month. This way, the budget grows daily just like your actual labor costs, enabling accurate month-to-date comparisons.

 

Budget MTD =
VAR CurrentDate = MAX('Calendar'[Date])
VAR StartOfMonth = DATE(YEAR(CurrentDate), MONTH(CurrentDate), 1)
VAR EndOfMonth = EOMONTH(CurrentDate, 0)
VAR DaysInMonth = DAY(EndOfMonth)
VAR DayOfMonth = DAY(CurrentDate)

VAR MonthlyBudget =
    CALCULATE(
        SUM('BudgetTable'[Budget]),
        'BudgetTable'[Date] = StartOfMonth
    )

RETURN
    DIVIDE(MonthlyBudget, DaysInMonth, BLANK()) * DayOfMonth

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
rajendraongole1
Super User
Super User

Hi @Adams_Apple  - can you try the below measure:

 

Labor Amount MTD Budget =
VAR CurrentDate = MAX('YourTable'[Date])
VAR MonthStart = EOMONTH(CurrentDate, -1) + 1
VAR MonthBudget = CALCULATE(
SUM('BudgetTable'[BudgetAmount]),
'BudgetTable'[Date] = MonthStart
)
VAR DaysInMonth = DAY(EOMONTH(CurrentDate, 0))
VAR DaysElapsed = DATEDIFF(MonthStart, CurrentDate, DAY)

RETURN
IF(
MonthBudget > 0,
(MonthBudget / DaysInMonth) * DaysElapsed
)

 

 





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.