
в html міру power bi потрібно додати пошук за група статті т...
Prompt
в html міру power bi потрібно додати пошук за група статті та стаття, а також другий пошук за ALL_Org_Items[org] , дай готовий виправлений код HTML_Plan_Fact_Report_Perfect = VAR _TableStyle = "<style>" & " .pbi-report { font-family: 'Segoe UI', Arial, sans-serif; width: 100%; font-size: 12px; color: #1e293b; background: #ffffff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden; }" & " " & " /* Шапка таблиці */" & " .tbl-header { display: grid; grid-template-columns: 38% 15.5% 15.5% 16% 15%; background-color: #0f172a; color: #ffffff; padding: 10px 12px; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; align-items: center; }" & " " & " /* Рівні згортання (Details/Summary) */" & " details { border-bottom: 1px solid #e2e8f0; margin: 0; background: #fff; }" & " details details { border-bottom: none; border-top: 1px dashed #f1f5f9; background: #fafafa; }" & " " & " summary { cursor: pointer; list-style: none; outline: none; transition: background-color 0.15s ease; }" & " summary::-webkit-details-marker { display: none; }" & " " & " /* Сітка 1-го рівня (Групи) */" & " .grp-grid { display: grid; grid-template-columns: 38% 15.5% 15.5% 16% 15%; padding: 10px 12px; align-items: center; font-weight: 700; color: #0f172a; font-size: 13px; background-color: #f8fafc; }" & " .grp-grid:hover { background-color: #f1f5f9; }" & " " & " /* Сітка 2-го рівня (Статті) */" & " .item-grid { display: grid; grid-template-columns: 38% 15.5% 15.5% 16% 15%; padding: 8px 12px; align-items: center; font-weight: 600; color: #334155; font-size: 12px; background-color: #ffffff; }" & " .item-grid:hover { background-color: #f1f5f9; }" & " " & " /* Таблиця 3-го рівня (Контрагенти) */" & " .org-table { width: 100%; border-collapse: collapse; font-size: 11px; background-color: #ffffff; }" & " .org-row td { padding: 6px 12px; border-top: 1px solid #f1f5f9; vertical-align: middle; color: #475569; }" & " .org-row:hover { background-color: #f8fafc; }" & " " & " .grp-title { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }" & " " & " /* Числові колонки та колірна підсвітка */" & " .num { text-align: right; font-family: 'Consolas', 'Segoe UI', monospace; white-space: nowrap; }" & " .pos-var { color: #16a34a; font-weight: 600; }" & " .neg-var { color: #dc2626; font-weight: 600; }" & " .neutral-var { color: #64748b; }" & " " & " .badge { padding: 2px 7px; border-radius: 12px; font-size: 10px; font-weight: 600; display: inline-block; text-align: center; min-width: 50px; }" & " .badge-green { background-color: #dcfce7; color: #15803d; }" & " .badge-red { background-color: #fee2e2; color: #b91c1c; }" & " .badge-gray { background-color: #f1f5f9; color: #475569; }" & " " & " /* Рядок підсумку */" & " .total-row { display: grid; grid-template-columns: 38% 15.5% 15.5% 16% 15%; background-color: #0f172a; color: #ffffff; padding: 12px; font-weight: 700; font-size: 13px; align-items: center; }" & "</style>" VAR _Header = "<div class='pbi-report'>" & "<div class='tbl-header'>" & " <div>Група / Стаття / Контрагент</div>" & " <div style='text-align: right;'>План (UAH)</div>" & " <div style='text-align: right;'>Факт (UAH)</div>" & " <div style='text-align: right;'>Відхилення</div>" & " <div style='text-align: right;'>Відхилення %</div>" & "</div>" -- 1-й РІВЕНЬ: ГРУПИ СТАТТЕЙ VAR _Groups = SUMMARIZE(ref_cfitems, ref_cfitems[Група Статті]) VAR _Body = CONCATENATEX( _Groups, VAR _CurrentGroup = ref_cfitems[Група Статті] VAR _GroupPlan = CALCULATE([Budget (UAH)], ref_cfitems[Група Статті] = _CurrentGroup) VAR _GroupFact = CALCULATE([Actual_Total_UAH], ref_cfitems[Група Статті] = _CurrentGroup) VAR _GroupVar = _GroupFact - _GroupPlan VAR _GroupVarPct = DIVIDE(_GroupVar, _GroupPlan, 0) VAR _GroupVarClass = IF(_GroupVar > 0, "pos-var", IF(_GroupVar < 0, "neg-var", "neutral-var")) VAR _GroupBadgeClass = IF(_GroupVar > 0, "badge-green", IF(_GroupVar < 0, "badge-red", "badge-gray")) VAR _GroupSign = IF(_GroupVar > 0, "+", "") -- 2-й РІВЕНЬ: СТАТТІ VAR _Items = CALCULATETABLE(SUMMARIZE(ALL_CF_Items, ALL_CF_Items[Стаття]), ref_cfitems[Група Статті] = _CurrentGroup) VAR _ItemsRows = CONCATENATEX( _Items, VAR _CurrentItem = ALL_CF_Items[Стаття] VAR _ItemPlan = CALCULATE([Budget (UAH)], ALL_CF_Items[Стаття] = _CurrentItem) VAR _ItemFact = CALCULATE([Actual_Total_UAH], ALL_CF_Items[Стаття] = _CurrentItem) VAR _ItemVar = _ItemFact - _ItemPlan VAR _ItemVarPct = DIVIDE(_ItemVar, _ItemPlan, 0) VAR _ItemVarClass = IF(_ItemVar > 0, "pos-var", IF(_ItemVar < 0, "neg-var", "neutral-var")) VAR _ItemBadgeClass = IF(_ItemVar > 0, "badge-green", IF(_ItemVar < 0, "badge-red", "badge-gray")) VAR _ItemSign = IF(_ItemVar > 0, "+", "") -- 3-й РІВЕНЬ: КОНТРАГЕНТИ (ALL_Org_Items[org]) VAR _Orgs = CALCULATETABLE(SUMMARIZE(ALL_Org_Items, ALL_Org_Items[org]), ALL_CF_Items[Стаття] = _CurrentItem) VAR _OrgsRows = CONCATENATEX( _Orgs, VAR _CurrentOrg = ALL_Org_Items[org] VAR _OrgPlan = CALCULATE([Budget (UAH)], ALL_Org_Items[org] = _CurrentOrg, ALL_CF_Items[Стаття] = _CurrentItem) VAR _OrgFact = CALCULATE([Actual_Total_UAH], ALL_Org_Items[org] = _CurrentOrg, ALL_CF_Items[Стаття] = _CurrentItem) VAR _OrgVar = _OrgFact - _OrgPlan VAR _OrgVarPct = DIVIDE(_OrgVar, _OrgPlan, 0) VAR _OrgVarClass = IF(_OrgVar > 0, "pos-var", IF(_OrgVar < 0, "neg-var", "neutral-var")) VAR _OrgBadgeClass = IF(_OrgVar > 0, "badge-green", IF(_OrgVar < 0, "badge-red", "badge-gray")) VAR _OrgSign = IF(_OrgVar > 0, "+", "") RETURN IF( NOT ISBLANK(_OrgPlan) || NOT ISBLANK(_OrgFact), "<tr class='org-row'>" & " <td style='width: 38%; padding-left: 42px;'><span style='color: #cbd5e1;'>└─</span> 🏢 " & _CurrentOrg & "</td>" & " <td class='num' style='width: 15.5%;'>" & FORMAT(_OrgPlan, "#,##0.00") & "</td>" & " <td class='num' style='width: 15.5%;'>" & FORMAT(_OrgFact, "#,##0.00") & "</td>" & " <td class='num " & _OrgVarClass & "' style='width: 16%;'>" & _OrgSign & FORMAT(_OrgVar, "#,##0.00") & "</td>" & " <td class='num' style='width: 15%;'><span class='badge " & _OrgBadgeClass & "'>" & _OrgSign & FORMAT(_OrgVarPct, "0.0%") & "</span></td>" & "</tr>", "" ), "", ALL_Org_Items[org] ) RETURN IF( NOT ISBLANK(_ItemPlan) || NOT ISBLANK(_ItemFact), "<details>" & " <summary>" & " <div class='item-grid'>" & " <div class='grp-title' style='padding-left: 18px;'><span style='color: #94a3b8;'>└─</span> " & _CurrentItem & "</div>" & " <div class='num'>" & FORMAT(_ItemPlan, "#,##0.00") & "</div>" & " <div class='num'>" & FORMAT(_ItemFact, "#,##0.00") & "</div>" & " <div class='num " & _ItemVarClass & "'>" & _ItemSign & FORMAT(_ItemVar, "#,##0.00") & "</div>" & " <div class='num'><span class='badge " & _ItemBadgeClass & "'>" & _ItemSign & FORMAT(_ItemVarPct, "0.0%") & "</span></div>" & " </div>" & " </summary>" & " <table class='org-table'><tbody>" & _OrgsRows & "</tbody></table>" & "</details>", "" ), "", ALL_CF_Items[Стаття] ) RETURN IF( NOT ISBLANK(_GroupPlan) || NOT ISBLANK(_GroupFact), "<details>" & " <summary>" & " <div class='grp-grid'>" & " <div class='grp-title'>📂 " & _CurrentGroup & "</div>" & " <div class='num'>" & FORMAT(_GroupPlan, "#,##0.00") & "</div>" & " <div class='num'>" & FORMAT(_GroupFact, "#,##0.00") & "</div>" & " <div class='num " & _GroupVarClass & "'>" & _GroupSign & FORMAT(_GroupVar, "#,##0.00") & "</div>" & " <div class='num'><span class='badge " & _GroupBadgeClass & "'>" & _GroupSign & FORMAT(_GroupVarPct, "0.0%") & "</span></div>" & " </div>" & " </summary>" & " <div>" & _ItemsRows & "</div>" & "</details>", "" ), "", ref_cfitems[Група Статті] ) -- РОЗРАХУНОК ЗАГАЛЬНОГО ПІДСУМКУ VAR _TotalPlan = [Budget (UAH)] VAR _TotalFact = [Actual_Total_UAH] VAR _TotalVar = _TotalFact - _TotalPlan VAR _TotalVarPct = DIVIDE(_TotalVar, _TotalPlan, 0) VAR _TotalSign = IF(_TotalVar > 0, "+", "") VAR _TotalBadgeClass = IF(_TotalVar > 0, "badge-green", IF(_TotalVar < 0, "badge-red", "badge-gray")) VAR _Footer = "<div class='total-row'>" & " <div>РАЗОМ / ВСЬОГО</div>" & " <div class='num'>" & FORMAT(_TotalPlan, "#,##0.00") & "</div>" & " <div class='num'>" & FORMAT(_TotalFact, "#,##0.00") & "</div>" & " <div class='num'>" & _TotalSign & FORMAT(_TotalVar, "#,##0.00") & "</div>" & " <div class='num'><span class='badge " & _TotalBadgeClass & "'>" & _TotalSign & FORMAT(_TotalVarPct, "0.0%") & "</span></div>" & "</div>" & "</div>" RETURN _TableStyle & _Header & _Body & _Footer