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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
joshua1990
Post Prodigy
Post Prodigy

Divide Weekly Budget by Working Days for Daily Phasing

Hello everybody!

I have to divide our weekly budget by the number of working days to get the daily budget.

The Budget table is linked with the YearWeek und Area Key to our Item Master and calendar table.

This Budget table has this structure:

Area - YearWeek - Budget

 

Now I need a measure that counts the number of working days for the corresponding week. This value should be used as a Denominator, right?

The calendar table contains the column "IsWorkingday" (0 or 1).

In addition, a non Working day should have no daily budget ( = 0 or Blank).

 

How would you solve that?

In the end I need also to use these daily budgets for a running total per week.

 

1 ACCEPTED SOLUTION

@joshua1990 

I have done the allocation of weekly budget amounts across dates based on the calendar using DAX as well. You will find both Power Query and DAX solutions in the same PBIX.

https://1drv.ms/u/s!AmoScH5srsIYgYIvB21vMVZ_J-WyYA?e=Yp33VU

Budget Allocation DAX = 

VAR T1 = 
    SELECTCOLUMNS(
        'Calendar',
        "DATE", 'Calendar'[Date],
        "Year-Week", 'Calendar'[YearWeek],
        "Week Day", 'Calendar'[IsWorkingday]
    )
VAR T2 = VALUES(Budget[Area])        
VAR T3 = CROSSJOIN( T1, T2)
RETURN
ADDCOLUMNS(
    T3,
    "Budget", 
        VAR BGT = 
            CALCULATE(
                SUM(Budget[Budget]),
                Budget[Area]=EARLIER([Area]),Budget[YearWeek]=EARLIER([Year-Week])
            )
        VAR EDAYS = 
            CALCULATE(
                SUM('Calendar'[IsWorkingday]),
                ALLEXCEPT('Calendar','Calendar'[YearWeek])               
            )            
        RETURN
        DIVIDE( BGT, EDAYS) * [Week Day]
) 

 

________________________

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

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

7 REPLIES 7
Fowmy
Super User
Super User

@joshua1990 

Can you share some sample data from the budget and calendar table along with the expected output for verification? This way, it will make it clear and easy for a quick solution.

________________________

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

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Of course! Thank you so much for your support!

Budget Table

AreaYearWeekBudget
A12020-01500
A12020-02750
A12020-03650
A12020-04500

Calendar Table

DateFiscal WeekYearYearWeekFiscal MonthIsWorkingday
31.12.190120202020-01Jan0
01.01.200120202020-01Jan1
02.01.200120202020-01Jan1
03.01.200120202020-01Jan1

 

@joshua1990 

Please find attached files Excel and PBIX. I have used Power Query to allocate the budget across dates:

https://1drv.ms/u/s!AmoScH5srsIYgYIraRzionKTxQjWgw?e=mIivjQ

Fowmy_0-1595671487806.png

________________________

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

I accept KUDOS 🙂

YouTube, LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thank you so much!

But I am looking for an approach based on dax measures.

How would you do that?

 

@Fowmy 

@joshua1990 

I have done the allocation of weekly budget amounts across dates based on the calendar using DAX as well. You will find both Power Query and DAX solutions in the same PBIX.

https://1drv.ms/u/s!AmoScH5srsIYgYIvB21vMVZ_J-WyYA?e=Yp33VU

Budget Allocation DAX = 

VAR T1 = 
    SELECTCOLUMNS(
        'Calendar',
        "DATE", 'Calendar'[Date],
        "Year-Week", 'Calendar'[YearWeek],
        "Week Day", 'Calendar'[IsWorkingday]
    )
VAR T2 = VALUES(Budget[Area])        
VAR T3 = CROSSJOIN( T1, T2)
RETURN
ADDCOLUMNS(
    T3,
    "Budget", 
        VAR BGT = 
            CALCULATE(
                SUM(Budget[Budget]),
                Budget[Area]=EARLIER([Area]),Budget[YearWeek]=EARLIER([Year-Week])
            )
        VAR EDAYS = 
            CALCULATE(
                SUM('Calendar'[IsWorkingday]),
                ALLEXCEPT('Calendar','Calendar'[YearWeek])               
            )            
        RETURN
        DIVIDE( BGT, EDAYS) * [Week Day]
) 

 

________________________

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

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thank you so much @Fowmy ! This is exactly what I am looking for.

Unfortunately, it is not working. I guess it is because of one thing:

All my tables are linked through a date or area key. 

There are numerous measures based on this structure/ relationship.

Is there any chance to adapt your approach with active relationships?

@joshua1990 

.

Glad you you like!

 

You need to connect your DATES table to this new budget allocation table using the date filed, do the same for AREA. Your model will work. You need to create measures for budget Amounts 


Please go ahead and accept this solution as I built  it as per your initial requirement. 

You may open a new ticket for your current request. 

 

________________________

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

I accept KUDOS 🙂

YouTube, LinkedIn

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors