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! Request now

Reply
joshua1990
Post Prodigy
Post Prodigy

Running total for Daily Budget based on DIVIDE

Hello everyone!

First of all, I am looking for a DAX measure. No additíonal tables or PQ. I would really like to solve the challenge just with DAX measures.

 

I am looking for a Running Total measure for weeks.

I have 3 tables  - within this context.

Budget table

YearWeek (key)Area (key)Budget
2020-01A5000
2020-02A4500

 

ItemMaster

Area (key)Department
ADrilling

 

Calendar

DateFiscal YearFiscal WeekYearWeek (key)
30.12.20192020012020-01
31.12.20192020012020-01

 

These tables are linked together through the corresponding key/ column.

Since the Budget table is based on weekly budget targets, I have to divide these by the number of working days per week.

I did this with the following measure:

 

# Working Days per Week = 
CALCULATE (
    SUM ( 'Calendar'[IsWorkingDay] ),
    ALL ( 'Calendar' ),
    VALUES ( 'Calendar'[Fiscal Week] ),
    VALUES ( 'Calendar'[Fiscal Year] )
)

 

 

Therefore the result looks like this:

DateBudgetWorking Days
01.01.2050005
02.01.2050005
03.01.2050005
04.01.2050005
05.01.2050005
06.01.2045004
07.01.2045004
08.01.2045004
09.01.2045004
10.01.2045004
11.01.2045004
12.01.2045004

 

With a measure like 

 

Budget RT = DIVIDE([Budget], [# Working Days per Week])

 

to get the daily budget the result looks like this:

DateBudgetWorking DaysDaily Budget
01.01.20500051000
02.01.20500051000
03.01.20500051000
04.01.20500051000
05.01.20500051000
06.01.20450041125
07.01.20450041125
08.01.20450041125
09.01.20450041125
10.01.20450041125
11.01.20450041125
12.01.20450041125

 

You can see the first mistake. Non-working days still get a value.

How can I solve that?

 

Then I would like to get a running total.

I have built this measure, but it is not working:

 

Test = 
CALCULATE (
    [Budget RT],
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Fiscal Year]
            = MAX ( 'Calendar'[Year] )
            && 'Calendar'[Date]
                <= MAX ( 'Calendar'[Date] )
            && 'Calendar'[Fiscal Month Number]
                = MAX ( 'Calendar'[Fiscal Month Number] )
            && 'Calendar'[Fiscal Week]
                = MAX ( 'Calendar'[Fiscal Week] )
    )
)

 

This measure is not accumulating the values.

Why is that so?

 

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

I think this could be simplified overall, but in your measure, if you are trying to have a running total go beyond the week or month, you also need to put "<=" for 'Calendar'[Fiscal Week] or 'Calendar'[Fiscal Month]. 

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


If that doesn't fix it, here is a measure expression that I think gets your desired results (see pic).  It didn't turn out to be as simply as I first thought, since you are showing day granularity when both working days and budget are in week granularity.  This assumes you have a Many:1 relationship between the Date[YearWeek] and Budget[YearWeek] columns.

 

Budget Running Total Week =
VAR thisweek =
    MIN ( 'Date'[YearWeek] )
VAR workingdaysthisweek =
    CALCULATE (
        SUM ( 'Date'[Working Day] ),
        ALL ( 'Date' ),
        'Date'[YearWeek] = thisweek
    )
VAR budgetthisweek =
    CALCULATE ( MIN ( Budget[Budget] ), 'Date' )
VAR dailybudget = budgetthisweek / workingdaysthisweek
VAR workingdaycount =
    COUNTROWS (
        FILTER (
            ALL ( 'Date' ),
            'Date'[Date] <= MAX ( 'Date'[Date] )
                && 'Date'[Working Day] = 1
                && 'Date'[YearWeek] = thisweek
        )
    )
RETURN
    workingdaycount * dailybudget

 

running budget.png

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.