Forum Discussion
Calculating Total Project Backlog Per Month
- 6 years ago
HI Anonymous
For your case, you need to add a start date column in your table, like this:
Then try this way as below:
Step1:
Create a dim Calendar table
Eg.
Calendar = CALENDARAUTO()Step2:
create a monthly project Cost column
monthly project Cost = 'Table'[total project Cost] / (DATEDIFF('Table'[Start Date],'Table'[end date],MONTH)+1)Step3:
Create a measure as below:
Total = VAR tmpCalendar = ADDCOLUMNS('Calendar',"Month",MONTH([Date]),"Year",YEAR([Date]),"MonthYear",VALUE(YEAR([Date]) & FORMAT(MONTH([Date]),"0#"))) VAR tmpBilling = ADDCOLUMNS('Table',"MonthYearBegin",VALUE(YEAR([Start Date]) & FORMAT(MONTH([Start Date]),"0#")), "MonthYearEnd",VALUE(YEAR([end date]) & FORMAT(MONTH([end date]),"0#"))) VAR tmpTable = SELECTCOLUMNS( FILTER( GENERATE( tmpBilling, SUMMARIZE(tmpCalendar,[Year],[Month],[MonthYear]) ), [MonthYear] >= [MonthYearBegin] && [MonthYear] <= [MonthYearEnd] ), "Project",[Project Number ], "Year",[Year], "Month",[Month], "Project Cost",[monthly project Cost] ) RETURN SUMX(tmpTable,[Project Cost])Result:
here is a same blog, you could refer to:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365
and here is my sample pbix file, please try it.
Regards,
lin
HI Anonymous
For your case, you need to add a start date column in your table, like this:
Then try this way as below:
Step1:
Create a dim Calendar table
Eg.
Calendar = CALENDARAUTO()
Step2:
create a monthly project Cost column
monthly project Cost = 'Table'[total project Cost] / (DATEDIFF('Table'[Start Date],'Table'[end date],MONTH)+1)
Step3:
Create a measure as below:
Total =
VAR tmpCalendar = ADDCOLUMNS('Calendar',"Month",MONTH([Date]),"Year",YEAR([Date]),"MonthYear",VALUE(YEAR([Date]) & FORMAT(MONTH([Date]),"0#")))
VAR tmpBilling = ADDCOLUMNS('Table',"MonthYearBegin",VALUE(YEAR([Start Date]) & FORMAT(MONTH([Start Date]),"0#")),
"MonthYearEnd",VALUE(YEAR([end date]) & FORMAT(MONTH([end date]),"0#")))
VAR tmpTable =
SELECTCOLUMNS(
FILTER(
GENERATE(
tmpBilling,
SUMMARIZE(tmpCalendar,[Year],[Month],[MonthYear])
),
[MonthYear] >= [MonthYearBegin] &&
[MonthYear] <= [MonthYearEnd]
),
"Project",[Project Number ],
"Year",[Year],
"Month",[Month],
"Project Cost",[monthly project Cost]
)
RETURN SUMX(tmpTable,[Project Cost])
Result:
here is a same blog, you could refer to:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365
and here is my sample pbix file, please try it.
Regards,
lin
v-lili6-msft Thank you so much for the reply I will give this a try today!