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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.