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
Anonymous
Not applicable

Dax - Split monthly budget into weekdays

Hi All,

 

I have two facttables in my tabular model; sales and budget, which do not have the same granularity.

My sales on a day level, and my budget on a monthly basis. I would like to split my monthly budget into week days.

I have tried follow SQLBI's budget patterns, but I can not get it to work - link: http://www.daxpatterns.com/budget-patterns/

 

In my fact sales fact look like this:

NB - Sales for each day in the month.

Capture.PNG

 

And my budget fact look like this:

NB - Budget for the first day of the month, e.g. 1st Maj 2017 and 1st June 2017.

 

Capture2.PNG

 

Both fact have a relation to my calendar, which have the following attributes:

Capture3.PNG

 

 

I would like to create dax formel that SPILT THE MONTHLY BUDGET INTO WEEKDAYS.

 

If the calendar IS filtered/drilled down to days; I would like to see budget on monday-friday, and no budget on saturday and Sunday.  

 

Based on SQLBI's blog post I have managed to calculate the number of week days for each month by using this:

 SUMX ( VALUES ( '02 Calendar'[CalendarID] ), CALCULATE ( COUNTROWS ( '02 Calendar' ), '02 Calendar'[Is Week Day] = 1 ) / CALCULATE ( COUNTROWS ( '02 Calendar' ), ALLEXCEPT ( '02 Calendar', '02 Calendar'[CalendarID] ), '02 Calendar'[Is Week Day] = 1 ) )

 

By dividing the budget with the above:

DIVIDE([AmountBUDX], SUMX ( VALUES ( '02 Calendar'[CalendarID] ), CALCULATE ( COUNTROWS ( '02 Calendar' ), '02 Calendar'[Is Week Day] = 1 ) / CALCULATE ( COUNTROWS ( '02 Calendar' ), ALLEXCEPT ( '02 Calendar', '02 Calendar'[CalendarID] ), '02 Calendar'[Is Week Day] = 1 ) ) )

I am able the get the budget per day.

 

In Excel it is shown as below:

Capture.PNG

And on a day level:

Capture2.PNG

 

 

However, I can not figure out how I get this shown on the day level? 

Can anyone help me?

 

NB - I have a relation for both my sales and my budget fact to the calendar dimension, by using the field CalendarID

 

1 REPLY 1
Anonymous
Not applicable

 

I have created a simple PBI model with the calendar dimension, fact sales, and fact budget.

Link to file: https://www.dropbox.com/s/fkge885z25rs4f2/budget%20split%20into%20days.pbix?dl=0

 

 Capture.PNG

Can someone help?

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.