# 7.6 Calculated fields आणि calculated items

Source: https://ravindrabagale.com/mr/excel/ch07-pivottables-and-pivotcharts/7-6-calculated-fields-and-calculated-items.html
Language: mr (Marathi with English technical terms)

हा lesson साध्या, non-Data-Model PivotTableमधल्या calculated fieldsसाठी आहे. Data Modelमध्ये याच menuऐवजी DAX measures वापरावे लागतात.

Commissionनंतरची Amount

Pivotमध्ये click › PivotTable Analyze › Calculations › Fields, Items, & Sets › Calculated Field.

Name: Net After Commission.

Formula: =Amount*0.98. Add › OK.

इथला 2% commission हा शिकण्यासाठी घेतलेला काल्पनिक rate आहे; कोणत्याही companyचा actual rate नाही.

AOVची योग्य अट

प्रत्येक source row एक unique order असेल तर Tableमध्ये Order Count नावाचा column आणि प्रत्येक rowमध्ये 1 घाला.

Pivot refresh करा.

Calculated Field: Name AOV; formula =Amount/'Order Count'. Rupee format द्या.

Calculated field या exampleमध्ये Sum of Amount ÷ Sum of Order Count करतो. एका orderच्या अनेक product rows असतील तर 1चा column order count देणार नाही. अशा वेळी आधी order-level summary तयार करा किंवा appropriate distinct-order measure वापरा.

Qty × Priceची चूक टाळा

Calculated field individual rowsवर calculation करत नाही. दोन rows: Qty 2, Price 10 आणि Qty 3, Price 20. योग्य total 2×10 + 3×20 = 80. Sum(Qty) × Sum(Price) केल्यास 5×30 = 150 — चुकीचं! म्हणून source Tableमध्ये row-level Amount तयार करून त्याची Sum करा.

Calculated Item

एखाद्या row/column fieldमध्ये Pune + Nashikसारखा नवीन item बनवायचा असल्यास त्या fieldचा item select करा › Fields, Items, & Sets › Calculated Item. Grouped itemsसोबत मर्यादा आहेत आणि totalsमध्ये double counting होऊ शकतं. फक्त cities एकत्र दाखवायच्या असतील तर grouping अधिक स्पष्ट पडतं.

Reference: Microsoft: PivotTable calculations.

Practice

Net After Commission आणि one-row-per-order sampleवर AOV बनवा. प्रत्येक Cityचा result SUMIFS/COUNTIFSने तपासा. मग एखादी order दोन linesमध्ये split केल्यावर countचा अर्थ कसा बदलतो ते समजावून लिहा.

रवींद्र बागले यांची tip

Ratio calculate करताना numerator आणि denominator कोणत्या levelवर आहेत ते पाहा. Average of row percentages आणि ratio of totals नेहमी सारखे नसतात.
