Forum Discussion
Calculating utilization by month
I have one set of data with demand by group by month, and another showing capacity of each group by month (see examples of data below):
Demand:
| Group | Date | Demand |
| A | Jan | 5 |
| A | Feb | 4 |
| A | Mar | 6 |
| A | Jan | 10 |
| A | Feb | 12 |
| A | Mar | 15 |
| B | Jan | 2 |
| B | Feb | 2 |
| B | Mar | 3 |
| B | Jan | 8 |
| B | Feb | 6 |
| B | Mar | 5 |
| C | Jan | 4 |
| C | Feb | 3 |
| C | Mar | 7 |
| C | Jan | 7 |
| C | Feb | 5 |
| C | Mar | 4 |
Capacity:
| Group | Jan | Feb | Mar |
| A | 15 | 15 | 20 |
| B | 12 | 10 | 10 |
I would like to summarize the demand by group by month and divide the results by capacity by month, resulting in a utilization pct by month, which would look something like this:
| Group | Jan | Feb | Mar |
| A | 100% | 107% | 105% |
| B | 83% | 80% | 80% |
I've tried several approaches with different calculations and data relationships (including an attempt at a bridge table), but haven't gotten anything to work. I'm obviously missing some basic concept. Any suggestions?
One of the methods
Go to Modelling Tab>>>NEW TABLE and enter this formula
Table = SUMMARIZE ( Capacity, Capacity[Group], "Jan", DIVIDE ( CALCULATE ( SUM ( Demand[Demand] ), Demand[Date] = "Jan" ), SUM ( Capacity[Jan] ) ), "Feb", DIVIDE ( CALCULATE ( SUM ( Demand[Demand] ), Demand[Date] = "Feb" ), SUM ( Capacity[Feb] ) ), "Mar", DIVIDE ( CALCULATE ( SUM ( Demand[Demand] ), Demand[Date] = "Mar" ), SUM ( Capacity[Mar] ) ) )
6 Replies
- Zubair_MuhammadCommunity Champion
One of the methods
Go to Modelling Tab>>>NEW TABLE and enter this formula
Table = SUMMARIZE ( Capacity, Capacity[Group], "Jan", DIVIDE ( CALCULATE ( SUM ( Demand[Demand] ), Demand[Date] = "Jan" ), SUM ( Capacity[Jan] ) ), "Feb", DIVIDE ( CALCULATE ( SUM ( Demand[Demand] ), Demand[Date] = "Feb" ), SUM ( Capacity[Feb] ) ), "Mar", DIVIDE ( CALCULATE ( SUM ( Demand[Demand] ), Demand[Date] = "Mar" ), SUM ( Capacity[Mar] ) ) )- Zubair_MuhammadCommunity Champion
- dsl72Regular Visitor
Thank you -- that worked great!
- AnonymousNot applicable
Dear Zubair,
Thanks for your help. That way, I have calculated utilization by personal. But I also need to utilize by departmant. In company, we are using Timesheet Application. We are taking their datas from sharepoint. So each week new datas are coming from personnal. Here I have a Calculated Table. In this table, I am measuring utilization by personnal with your solution. These are utilization of the personnal by week. However, I also need to measure them by Department. Each week measuring by itself. So it is empty, if that week didn't come.
Personal Department Job Week 1 Week 2 Week 3 Week 4 … Week 53 A Research Engineer 0.99 0.45 0.38 0.44 B Research Technician 0.73 0.36 0.71 0.36 C Sales Service 0.34 0.71 0.41 0.61 D Research Engineer 0.46 0.56 0.39 0.57 E Research Engineer 1.23 0.37 0.94 0.89
DAX is like that;
Table =
SUMMARIZE (
RateListBU;
RateListBU[Department];RateListBU[Job];RateListBU[Personal];
"Week 1"; DIVIDE (
CALCULATE (SUM ( TimeSheetPlusListBU[Billable Hours] ); TimeSheetPlusListBU[Period] = "Week 1");
SUM ( RateListBU[Week 1] )
);
"Week 2"; DIVIDE (
CALCULATE (SUM ( TimeSheetPlusListBU[Billable Hours] ); TimeSheetPlusListBU[Period] = "Week 2");
SUM ( RateListBU[Week 2] )
);
"Week 3"; DIVIDE (
CALCULATE (SUM ( TimeSheetPlusListBU[Billable Hours] ); TimeSheetPlusListBU[Period] = "Week 3" );
SUM ( RateListBU[Week 3] )
);
"Week 4"; DIVIDE (
CALCULATE (SUM ( TimeSheetPlusListBU[Billable Hours] ); TimeSheetPlusListBU[Period] = "Week 4" );
SUM ( RateListBU[Week 4] )
);
..
"Week 53"; DIVIDE (
CALCULATE (SUM ( TimeSheetPlusListBU[Billable Hours] ); TimeSheetPlusListBU[Period] = "Week 53" );
SUM ( RateListBU[Week 53] )
);
)With each week, new week utilization value by personal is creating. How can I calculate utilize by departmant? For example Week 1 of Research Department Utilization?
- lndnbrgResolver IIIHi!
I would unpivot the capacity table in the query, so that you get a month column. Now, you have the same columns like the demand table.
Now, I would make sure that you have tables with groups and months. You can now create relationships to both tables.
In the end, you can create a simple measure: DIVIDE(SUM(Demand[Demand]);SUM(Capacity[Capacity]))
Does this make sense for you? - horseyrideFrequent Visitor
Bring both tables into powerquery
For capacity, Unpivot the table to get each month in its own row
For demand, group on Group/Date to combine the demand numbers
Then Merge in Capacity and expand, adding each capacity number
In a pivot table based on Demand Query add a calculated field with formulat =IFERROR(Sum/Capacity,NA())
Voila
Table Query
-----------------
let
Source = Excel.CurrentWorkbook(){[Name="Capacity"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Group", type text}, {"Jan", Int64.Type}, {"Feb", Int64.Type}, {"Mar", Int64.Type}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Group"}, "Attribute", "Value"),
#"Renamed Columns" = Table.RenameColumns(#"Unpivoted Columns",{{"Attribute", "Date"}})
in
#"Renamed Columns"Demand Query
------------
let
Source = Excel.CurrentWorkbook(){[Name="Demand"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Group", type text}, {"Date", type text}, {"Demand", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Group", "Date"}, {{"Sum", each List.Sum([Demand]), type number}}),
#"Merged Queries" = Table.NestedJoin(#"Grouped Rows",{"Group", "Date"},Capacity,{"Group", "Date"},"NewColumn",JoinKind.LeftOuter),
#"Expanded NewColumn" = Table.ExpandTableColumn(#"Merged Queries", "NewColumn", {"Value"}, {"Capacity"})
in
#"Expanded NewColumn"