我有一个Power BI报告,该报告可计算一个月内到期的作业数量,并报告按时完成多少作业。该报告运行良好,只是度量总计未正确汇总,如表列所示。
我已采取以下措施:
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."
其他字段:
DUE = Due Date
completed = job completion date
I have found a possible answer to this using (HASONEFILTER) but cannot get it to work.
措施
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