Forum Discussion
Improve XmR Graph visual performance - Need Help
- Anonymous1 year ago
Hi KrisKolady,
Consider combining the calculations for
XMR Avg ValandXmR Avg mRinto a single measure, you can avoid redundant calls toTODAY()and the time range logic.
Sample code:XMR Avg Combined = VAR LastDatePreviousMonth = EOMONTH(TODAY(), -1) VAR LastPeriodDate = DATE(YEAR(LastDatePreviousMonth) - 1, MONTH(LastDatePreviousMonth), DAY(LastDatePreviousMonth)) VAR Period = DATESINPERIOD(DateCalendar[Date], LastPeriodDate, -24, MONTH) VAR AvgVal = CALCULATE( AVERAGEX(VALUES(DateCalendar[YearMon]), [XmR Value]), Period ) VAR AvgMR = CALCULATE( AVERAGEX(VALUES(DateCalendar[YearMon]), [XmR mR]), Period ) RETURN AvgVal & "|" & AvgMRNext, use this combined measure in your control line calculations:
XmR Chart LCL = VAR Combined = [XMR Avg Combined] VAR AvgVal = VALUE(LEFT(Combined, FIND("|", Combined) - 1)) VAR AvgMR = VALUE(MID(Combined, FIND("|", Combined) + 1, LEN(Combined))) RETURN MAX(AvgVal - 2.66 * AvgMR, 0)Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi KrisKolady,
Consider combining the calculations for XMR Avg Val and XmR Avg mR into a single measure, you can avoid redundant calls to TODAY() and the time range logic.
Sample code:
XMR Avg Combined =
VAR LastDatePreviousMonth = EOMONTH(TODAY(), -1)
VAR LastPeriodDate = DATE(YEAR(LastDatePreviousMonth) - 1, MONTH(LastDatePreviousMonth), DAY(LastDatePreviousMonth))
VAR Period = DATESINPERIOD(DateCalendar[Date], LastPeriodDate, -24, MONTH)
VAR AvgVal = CALCULATE(
AVERAGEX(VALUES(DateCalendar[YearMon]), [XmR Value]),
Period
)
VAR AvgMR = CALCULATE(
AVERAGEX(VALUES(DateCalendar[YearMon]), [XmR mR]),
Period
)
RETURN
AvgVal & "|" & AvgMR
Next, use this combined measure in your control line calculations:
XmR Chart LCL =
VAR Combined = [XMR Avg Combined]
VAR AvgVal = VALUE(LEFT(Combined, FIND("|", Combined) - 1))
VAR AvgMR = VALUE(MID(Combined, FIND("|", Combined) + 1, LEN(Combined)))
RETURN MAX(AvgVal - 2.66 * AvgMR, 0)
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.