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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
nimp_kp
Frequent Visitor

Calculating budget across years

Hi

 

I have a matrix like this in my report, that shows budget and actual costs on a project. 

                2020202020212021
Project Employee  budget  actual  budget  actual
MyProject  Person A500600400350
MyProjectPerson B  200150
MyProjectPerson C300200400500
 Total80080010001000

 

But I'm trying to add an extra measure that shows the total variance for the entire duration of the project.

For Person A, that would be: 500 + 400 - 600 - 350 = -50.

The problem is Person B, who doesnt have any budget or costs in 2020, so the total variance is blank that year, but correct in 2021.

I want the total variance to be exactly the same each year.

Is there a way to do this?

  202020202020202120212021
ProjectEmployee budget actual  Total variance on projectbudget  actual  Total variance on project
MyProject  Person A500600-50400350-50
MyProjectPerson B   20015050
MyProjectPerson C30020004005000
 Total800 8000100010000
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @nimp_kp ,

You can create another new measure as below and put this new measure to replace the original measure onto the matrix visual... Please find the details in the attachment.

Measure =
VAR _budget =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "budget" )
VAR _actual =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "actual" )
RETURN
    IF ( ISINSCOPE ( 'Table'[Type] ), SUM ( 'Table'[Value] ), _budget - _actual )

yingyinr_0-1664786329696.png

 

If the above one can't help you get the desired result, please provide more raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @nimp_kp ,

You can create another new measure as below and put this new measure to replace the original measure onto the matrix visual... Please find the details in the attachment.

Measure =
VAR _budget =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "budget" )
VAR _actual =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "actual" )
RETURN
    IF ( ISINSCOPE ( 'Table'[Type] ), SUM ( 'Table'[Value] ), _budget - _actual )

yingyinr_0-1664786329696.png

 

If the above one can't help you get the desired result, please provide more raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@nimp_kp , Is not

 

measure = sum(Table[Budget]) - Sum(Table[Actual])

 

or

 

measure = calculate(sum(Table[Budget]) - Sum(Table[Actual]), removefilters(Table[Year]))

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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