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
ghdunn
Helper III
Helper III

Monthly Project Cost/Revenue Calculation

I am working on a project forecasting tool in Power Apps/Model Driven Apps, but have come across some reporting challenges that are beyond my skills (though thanks to @Jimmy801  I am moving slowly up the curve in that I am working with Table.FromColumns but it will be some time before I can master the following:+)

 

He has provided an answer to one challenge of spreading total project costs over  a number of months:

 

https://community.powerbi.com/t5/Power-Query/Pro-rate-project-value-over-a-number-of-months/m-p/9289...

 

However, I now move on to another challenge of creating total, monthly project costs from the bottom up calculation of individual resources.

 

If you have a resource at a daily rate of $500, and assign them to a date range of 12th Feb through to 31st May, how can you calculate monthly charges, according to working days.

 

Input:

Resource, Rate, Start, End

A,$500,12/2/20,31/5/20

B,$200,29/2/20,15/5/20

 

Expected Output:

Month,Resource,TotalCharge

Feb,A,6500   (being 13 working days at 500)

Feb,B,NIL      (being no working days in Feb)

Mar,A     etc

 

Thanks!

 

Ged

 

 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @ghdunn 

For your case, you could try this way as below:

Step1:

You need a calendar date table, you could use this formula to create this table:

Date = ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]),"Day",DAY([Date]),"Weekday",WEEKDAY([Date],2))

Step2:

Create a new table as below:

New table = FILTER(CROSSJOIN('Table','Date'),'Date'[Date]>='Table'[Start]&&'Date'[Date]<='Table'[End])

Step3:

Then create a TotalCharge measure as below:

TotalCharge = CALCULATE(SUM('New table'[Rate]),FILTER('New table','New table'[Weekday] in {1,2,3,4,5}))

Result:

1.JPG

 

Regards,

Lin

Community Support Team _ Lin
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-lili6-msft
Community Support
Community Support

hi  @ghdunn 

For your case, you could try this way as below:

Step1:

You need a calendar date table, you could use this formula to create this table:

Date = ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]),"Day",DAY([Date]),"Weekday",WEEKDAY([Date],2))

Step2:

Create a new table as below:

New table = FILTER(CROSSJOIN('Table','Date'),'Date'[Date]>='Table'[Start]&&'Date'[Date]<='Table'[End])

Step3:

Then create a TotalCharge measure as below:

TotalCharge = CALCULATE(SUM('New table'[Rate]),FILTER('New table','New table'[Weekday] in {1,2,3,4,5}))

Result:

1.JPG

 

Regards,

Lin

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

Hi 

 

Project IDProject Name Start Date End DateDaily Cost
1A01-01-1931-12-262000
2B01-06-2105-12-231000
3C15-04-1818-10-227500
PREVIEW
 
I want to get the respective Cost dynamicaaly based on Date range selected.

Is it possible to achieve it using DAX measure instead of creating a new table.
Here's my sample DAX measure which is giving me wrong result.
Cost =
var MaxDate = Max('Date'[Date])
var MinDate = Min('Date'[Date])

var Costt = CALCULATE(SUM(Project[Daily Cost]), ALL('Date'), Project[Start Date]<=MinDate && Project[End Date]>=MaxDate)

return Costt
Any help would be appreciable.
 
Regards,
Prajna
 
 

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.