Forum Discussion
Correct my Summarize Measure
Hi, Learner27
Try this code. It should improve the performance.
Commercial Install =
Var _le =
CALCULATE (
SUM ( ST_Activity_Report[PaidDuration] ),
ST_Activity_Report[IsCommercialInstall],
USERELATIONSHIP ( ST_Activity_Report[Indirect Key], ST_PFP_Report[ID key] )
)
Var _Lab =
CALCULATE (
SUM ( Install_Input[LaborEarnings] ),
ST_PFP_Report[IsCommercialInstall],
USERELATIONSHIP ( Install_Input[PFPWeekly_Yearweeknum], ST_PFP_Report[Jobtime_Yearweeknum] )
)
Var _Install =
IF ( _Lab > 0, _Lab, _le * [#Rate For Work SPRT] )
Return
IF ( ISBLANK ( _Install ), 0, _Install )
Here, ST_Activity_Report[IsCommercialInstall] and ST_PFP_Report[IsCommercialInstall] are new calculated columns.
You can create IsCommercialInstall column like this:
IsCommercialInstall =
IF (
ST_Activity_Report[BusinessUnit] IN {"Commercial Install","Commercial - Installs","Commercial Services - Buffalo"},
TRUE,
FALSE
)