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
Marcus_E
Helper I
Helper I

Calculate monthly variance

Hi everyone

Fairly new here to BI and am grappling with a suitable way to calculate the difference between Actual costs versus Budget costs on a monthly basis.

Ideally I would like to have a DAX measure that can pull together the total Actual costs and then seperately Budget costs incurred during successive months.

A simplified version of my data set is below:

Cost CentreAllocationCostsMonth
Cost centre 1Actual $                    100Jan-19
Cost centre 2Actual $                    350Jan-19
Cost centre 3Actual $                2,500Jan-19
Cost centre 1Budget $                      80Jan-19
Cost centre 2Budget $                    400Jan-19
Cost centre 3Budget $                2,600Jan-19
Cost centre 1Actual $                      95Feb-19
Cost centre 2Actual $                    420Feb-19
Cost centre 3Actual $                3,000Feb-19
Cost centre 1Budget $                      80Feb-19
Cost centre 2Budget $                    400Feb-19
Cost centre 3Budget $                2,600Feb-19
Cost centre 1Actual $                    110Mar-19
Cost centre 2Actual $                    380Mar-19
Cost centre 3Actual $                2,400Mar-19
Cost centre 1Budget $                      80Mar-19
Cost centre 2Budget $                    400Mar-19
Cost centre 3Budget $                2,600Mar-19

 

I'm struggling to pull out the Actual costs and separate from the Budget costs but I'm trying to achieve a result that would look something like this:

Actual $                2,950Jan-19
Budget $                3,080Jan-19
Actual $                3,515Feb-19
Budget $                3,080Feb-19
Actual $                2,890Mar-19
Budget $                3,080Mar-19

 

Appreciate any thoughts or suggestions.

 

1 ACCEPTED SOLUTION

And with a filter it looks like this:

bud1.PNG

 





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

Proud to be a Super User!




View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Nathaniel_C
Super User
Super User

@Marcus_E 
Try this:

bud.PNG

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

Actual costs = 
var _actual = CALCULATE(SUM('Table'[Costs]),ALLEXCEPT('Table','Table'[Cost Centre],'Table'[Month]),'Table'[Allocation]= "Actual")

return _actual

Budget Costs = 
var _actual = CALCULATE(SUM('Table'[Costs]),ALLEXCEPT('Table','Table'[Cost Centre],'Table'[Month]),'Table'[Allocation]= "Budget")

return _actuaL




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

Proud to be a Super User!




And with a filter it looks like this:

bud1.PNG

 





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

Proud to be a Super User!




@Nathaniel_C 

 

Just wondering if you would have any thoughts on how to introduce a measure to calculate the Variance between Budget and Actual? I realise that it would normally be a case of subtracting Total Actual from Total Budget which works fine if I'm only after a static total variance value for the nominated period. The problem I've found is that when introducing other slicer filters on the visual, the Total Actual, Total Budget and Total Variance values do not change.

 

For example I added another data field of Cost Responsibility and when attempting to use the slicer filter the three actual, budget and variance values won't change. Therefore I've had to resort to using Filters on This Page to link the values back to the slicer otherwise they remain unchanged.

 

I'm most likely missing something simple here, but the variance is the key to the visuals I'm trying to produce and I really don't want to add a calculated column into the data set if it can be avoided.

 

Many thanks.


@Nathaniel_C wrote:

And with a filter it looks like this:

bud1.PNG

 


 

Hi @Marcus_E ,

Is it possible to share a sanitized pbix with us? Or dummy up one.  The important parts would be the slicers, tables and the relationships that impact this.  I am sure the solution is there somewhere, there are a lot of brilliant people on this forum.  I might even post this as a new issue.  If you send me a pm, I will make sure to look at it, although I have a busy weekend. Another thing that I have seen some posters do is to put that top 5 on the the leaderboard.  @Nathaniel_C  will get a message sent to my box.

Good luck!





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

Proud to be a Super User!




Many thanks for the prompt solution(s). They work perfectly for what I'm trying to achieve.

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.