I have a Power BI report that calculates the number of jobs due in a month and reports on how many jobs are completed on time. The report works well except the measure totals do not add up correctly like the table columns do.
I have measures in place for:
Done on time = Jobs completed in their due month
Outside time = Jobs completed after when they were due.
Incomplete = Used to identify incomplete jobs
% Perf = Percentage of jobs completed on time."
Other fields:
DUE = Due Date
completed = job completion date
I have found a possible answer to this using (HASONEFILTER) but cannot get it to work.
MEASURES
Done on time =
VAR DueMonth = MONTH ( FIRSTDATE ( Table1[due_date] ) )
RETURN
CALCULATE (
[Due],
FILTER ( Table1,
MONTH ( Table1[completed] ) = DueMonth || MONTH (
Table1[completed] ) = DueMonth -1 || MONTH ( Table1[completed] ) = DueMonth +1
)
)
Outside time =
VAR DueMonth = MONTH ( FIRSTDATE ( Table1[due_date] ) )
RETURN
CALCULATE (
[Due] - [Done on time],
FILTER (
Table1,
MONTH ( Table1[completed] ) <> DueMonth || MONTH ( Table1[completed] ) = DueMonth -1 || MONTH ( Table1[completed] ) = DueMonth +1 ||
NOT ISBLANK ( Table1[completed] )
)
)
% Perf =
DIVIDE (
[Done on time],
[Due],
BLANK()
) * 100
Results would be properly totaled column measure's, screenshot below of existing output.