feat(project): 연간 목표 로아스 연간·상반기·하반기 목표/실적 계산
- 기간 로아스 = 기간 매출 ÷ 기간 광고비 — 월 광고비를 매출 ÷ 로아스로 환산해 합친 매출 가중 평균 (목표는 매출 목표, 실적은 매출 실적으로), 매출이 없는 달이 섞이면 단순 평균. 말풍선에 방식·개월 수 - 화면 계산(저장 안 함), 숫자 칸을 고치면 바로 다시 계산. 캐시 버전 20261001e, 문서 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8089,6 +8089,30 @@
|
||||
rt.dataset.tip = tUpTo ? "실적이 있는 달의 목표 합계 대비" : "";
|
||||
}
|
||||
});
|
||||
// 로아스 연간·반기 — 기간 로아스 = 기간 매출 ÷ 기간 광고비. 광고비를 따로 적지 않으니 월마다 매출 ÷ 로아스로 환산해
|
||||
// 합친다(매출 가중 평균). 로아스가 있는 달 중 매출(같은 목표/실적)이 없는 달이 있으면 단순 평균.
|
||||
["target", "actual"].forEach(function (kind) {
|
||||
const roas = values("roas", kind), sales = kind === "target" ? tg : ac;
|
||||
SUM_SCOPES.forEach(function (sc) {
|
||||
const td = table.querySelector('.pj-goal-sum[data-metric="roas"][data-kind="' + kind + '"][data-scope="' + sc[0] + '"]');
|
||||
if (!td) return;
|
||||
const months = [];
|
||||
for (let m = sc[1]; m <= sc[2]; m++) if (roas[m] != null && roas[m] > 0) months.push(m);
|
||||
if (!months.length) { td.textContent = ""; td.dataset.tip = ""; return; }
|
||||
const weighted = months.every(function (m) { return sales[m] != null && sales[m] > 0; });
|
||||
let v;
|
||||
if (weighted) {
|
||||
let s = 0, spend = 0;
|
||||
months.forEach(function (m) { s += sales[m]; spend += sales[m] / roas[m]; });
|
||||
v = s / spend;
|
||||
} else {
|
||||
v = months.reduce(function (a, m) { return a + roas[m]; }, 0) / months.length;
|
||||
}
|
||||
td.textContent = (Math.round(v * 10) / 10).toLocaleString("ko-KR") + "%";
|
||||
td.dataset.tip = (weighted ? "매출 가중 평균(월 광고비 = 매출 ÷ 로아스로 환산)" : "단순 평균(매출이 없는 달이 있어서)") +
|
||||
" · " + months.length + "개월";
|
||||
});
|
||||
});
|
||||
}
|
||||
recompute();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user