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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
LittleAnners_08
Frequent Visitor

Multiply weekly Budget based on Filtered Month Selected

HI 

I have several tables for monitoring budgets against spend by month.

Current layout allows user to filter report using several slicers in order to review 100's of various budgets.

All works fine, however, I now need the end user to be able to filter by month so they can see the monthly spend versus the monthly budget, currently only shows by Yearly Budget

Slicer:  Calendar Month

1.  Measure 1 = "Budget per Week" i.e Total Yearly Budget divided by 52

2.  Measure 2 = "No. Weeks" i.e Weeks per Calendar Month

 

Monthly Budget =
VAR BudgetbyWk = [Budget per Week]
VAR NoWeeks = [No. Weeks]
RETURN
BudgetbyWk*NoWeeks

 

Result Given: Just gives Total budget, but when month is selected the values go blank, I thought I needed to put the relationship between budget & calendar tables to both, however, if I do this, it then in turn breaks other visuals by filtering it all to current month, which is not what I want......only need the above new measure to filter.

Result needed: I am missing a line for the filtering of the Calendar Month slicer, by one or multi selected months,  however I have tried several options by using Selectedvalue, Calculate, Filter etc. but the end result is not populating

 

Any ideas what I'm doing wrong I would really appreciate it.

Thanks

1 ACCEPTED SOLUTION

@LittleAnners_08 

The fact that you're using the KPI visual makes a BIG difference. I'm not sure how it will behave with a non-date trend. Do you have a proper Date table rather than just the Months table? If you get a Date table, you should be able to create a generic budget measure: 
Budget = SUM(Budget[Value])

and monthly spend measure:

Spend = SUM(SpendTable[SpendValue])

 

Ensure both the Budget and the SpendTable are connected to the Date table using a Date or DateKey column (even if budgets are monthly, you'll need to pick a day of the month - I use the 1st of the month) with a one to many relationship for both. Then put Calendar Month in the trend and the KPI visual will do the rest of the filtering/work for you based on the latest calendar date selected in your filter/slicer/report. 

 

Does that make sense?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

3 REPLIES 3
AllisonKennedy
Super User
Super User

@LittleAnners_08  This looks like a context error. What is the formula for your two measures please that you're referencing and what fields do you have in the visuals where you want this to work?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi @AllisonKennedy 

Thanks for coming back to me:

1.  Measure 1 = "Budget per Week"  The formula for this one is just a simple division: 

Budget per Week = Divide(sum('Job Budgets'[ForecastYearBudget]),52) 

 

2.  Measure 2 = "No. Weeks" This is a simple sum measure driven by a calculated column that counts the number of weeks based on our working month:

Calculated column is: MonthWeeks = (Months[LastWorkDayDate]-Months[FirstWorkDayDate])/7+1

Which then has Measure 2:

No. Weeks = Sum(MonthWeeks)

 

The visual is a KPI gauge that shows :

  1. Indicator = Current Spend
  2. Trend = Team
  3. Target Goals = Monthly Budget (ie: formula with the Issue)

 

Thank you

@LittleAnners_08 

The fact that you're using the KPI visual makes a BIG difference. I'm not sure how it will behave with a non-date trend. Do you have a proper Date table rather than just the Months table? If you get a Date table, you should be able to create a generic budget measure: 
Budget = SUM(Budget[Value])

and monthly spend measure:

Spend = SUM(SpendTable[SpendValue])

 

Ensure both the Budget and the SpendTable are connected to the Date table using a Date or DateKey column (even if budgets are monthly, you'll need to pick a day of the month - I use the 1st of the month) with a one to many relationship for both. Then put Calendar Month in the trend and the KPI visual will do the rest of the filtering/work for you based on the latest calendar date selected in your filter/slicer/report. 

 

Does that make sense?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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