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

Running total from project budget minus monthly cost

Hey everyone,

 

I work at a construction company, and I'm trying to develop a visual for the burndown rate on each project. I have two datasets, one contains the budget information for each project (this dataset contains budgeted line items for each project and is for the most part stagnant), and the other dataset contains costs associated with the project (this dataset updates daily with new costs). I would like the visual to end up looking something like the chart below:

Burndown Chart.png

I can generate monthly cost totals easily enough, but I'm having trouble figuring out how to get a running total for the remaining budget (total cost - original budget total).  my two datasets contain the information below:

 

Budget Database:

Project IDOriginal Budget
5629499535225381862541
56294995358805512563839
5629499535634511263489
562949953611947759362

 

Cost Database:

Project IDDateCost Amount
5629499535225384/12/225000
5629499535225384/25/2212000
5629499535225385/13/22100000
5629499535880554/1/2260000
5629499535880555/1/2218000
5629499535634515/5/222500
5629499536119475/12/227500
5629499536119475/2/2236000

 

I'm not sure if the best way to go about this would be through creating a calculated column in the cost database somehow or if I could do this all within a visual somehow (I haven't been able to find a way to accomplish that yet). Any help or direction would be greatly appreciated. 

 

Thanks! 

Cole

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@Anonymous follow these steps:
1. Create a relatioshiop (one to many) between the 2 tables through the Project ID:

SpartaBI_1-1652456306596.png


2. Create these measure:

 

$ Cost = SUM(Cost[Cost Amount])

$ Cost RT = 
VAR _current_date = MAX(Cost[Date])
RETURN 
CALCULATE(
    [$ Cost],
    Cost[Date] <= _current_date
)

Remaining Budget = SUM(Budget[Original Budget]) - [Cost RT]

 


3. Put the date and measures in the chart like this (this is the result we get from your sample data):

SpartaBI_2-1652456521963.png

 

This is of course also repecting filters that you will choose from the Projcect ID column in the Budget Table (Filters by default go from the 1 side to the many side)



2022-05-09 22_36_04-Power BI Workspace Datasets License Permissions - Microsoft Power BI Community.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png  SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

View solution in original post

9 REPLIES 9
SpartaBI
Community Champion
Community Champion

@Anonymous follow these steps:
1. Create a relatioshiop (one to many) between the 2 tables through the Project ID:

SpartaBI_1-1652456306596.png


2. Create these measure:

 

$ Cost = SUM(Cost[Cost Amount])

$ Cost RT = 
VAR _current_date = MAX(Cost[Date])
RETURN 
CALCULATE(
    [$ Cost],
    Cost[Date] <= _current_date
)

Remaining Budget = SUM(Budget[Original Budget]) - [Cost RT]

 


3. Put the date and measures in the chart like this (this is the result we get from your sample data):

SpartaBI_2-1652456521963.png

 

This is of course also repecting filters that you will choose from the Projcect ID column in the Budget Table (Filters by default go from the 1 side to the many side)



2022-05-09 22_36_04-Power BI Workspace Datasets License Permissions - Microsoft Power BI Community.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png  SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

Anonymous
Not applicable

Hey SpartaBI,

 

Thanks for your response! I was able to recreate the measures you indicated above however I am getting the result below:

 

cwent_0-1652720950304.png

 

One problem I ran into was that my budget data set actually contains a row for each budgeted line item in a project, so I can't create a one to many relationship between those two datasets, would that be the reason I am getting this result? 

 

thanks in advance for your help! 

@Anonymous not sure if that is the reason, I think more like you maybe using the wrong date column in the axis, but anyway we can check this. You can force a 1:1 to be 1:m in the relationship dialog. Please try that (and make sure the direction is from budget to cost like in my screenshop and update me after.
P.S  if the relationship is 1:1 than you should have better just put everything in the same table. Is there a reason they are splitted?

Anonymous
Not applicable

@SpartaBI The relationship is not 1:1, sorry if my response was unclear. The project IDs appear multiple times in both tables and their instances do not correspond to each other so the relationship is m:m. 

 

cwent_0-1652799077036.png

Does this change anything? 

 

thanks again for your help! 

 

@Anonymous
Ye, this change 🙂
Why do you have duplicate rows for same project in the budget table? Shouldn't each row represent the total budget for that project? I fear that the budget amount is duplicated. Very hard to tell with info supplied
Also, please, anyway, make the relationship one way from the budget to the cost table

Anonymous
Not applicable

@SpartaBI the budget table includes each line item making up the total budget for each project. for instance here is a portion of the table:

 

cwent_0-1652809503856.png

I apologize for not clearly explaining the budget table in my first post, hopefully this makes a little more sense. 

 

Essentially I will be taking a sum of the original budget column for each project, and that is the basis of my running remaining budget. 

 

Thanks again for your help!

 

 

@Anonymous no worries 🙂
It should be really easy to solve. The many to many in this case is not a big issue, because your granularity of project is the one you need so the results should be ok. Regarding the line, it looks like you are reducing cost and not RT cost, but the measures I wrote you should have work:

$ Cost = SUM(Cost[Cost Amount])

$ Cost RT = 
VAR _current_date = MAX(Cost[Date])
RETURN 
CALCULATE(
    [$ Cost],
    Cost[Date] <= _current_date
)

Remaining Budget = SUM(Budget[Original Budget]) - [Cost RT]

Are you sure you put [Cost RT] and not just cost in the final measue?

Anonymous
Not applicable

@SpartaBI that was it! thank you so much for your help.

 

I have one last question, instead of the visual displaying each individual cost, is there a way that I could group the costs by month? Since the date column in the cost table is not a date table it won't give me the option to pull only the month and year. 

 

Thank you so much! 

@Anonymous my pleasure.

Not sure I understood what is missing for you, but I think better anyway for community visability to open a new question in the forum with all the relevant details, your current status and what the issue you need to solve.

I'll be happy to take a look on it, will only get to this tomorrow but I'm pretty sure someone will help.

Don't forget to mark the 1st message I wrote with the codes as a solution for community visabilty.

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.