# 10.6 Unpivot — monthly columnsच्या rows

Source: https://ravindrabagale.com/mr/excel/ch10-power-query-in-excel/10-6-unpivot.html
Language: mr (Marathi with English technical terms)

Cityच्या पुढे Jan, Feb, Mar अशी columns असलेलं wide sheet analysisसाठी City, Month, Sales या long formatमध्ये आणू.

Steps

Module 5.17ची wide table Power Queryमध्ये load करा.

जपायचे identifier columns, उदा. City, select करा.

Transform › Unpivot Columns dropdown › Unpivot Other Columns.

Attribute → Month, Value → Sales/Target अशी नावं द्या.

Month textला date हवी असेल आणि सर्व recordsचं वर्ष 2026 असल्याचं निश्चित असेल तर:

Date.FromText("01-" & [Month] & "-2026",[Culture="en-IN"])

हा formula Jan/Febसारख्या expected labelsसाठी आहे. अनेक वर्षं असतील तर actual Year column वापरा; hard-coded 2026 नको. Outputला Date type द्या.

Target विरुद्ध Actual

सहा Cities × 12 months = 72 values, सर्व cells non-null असतील तर 72 rows. Unpivotमध्ये null values वगळल्या जाऊ शकतात; म्हणून 72पेक्षा कमी rows दिसल्या तर missing targets तपासा. Missing targetला लगेच zero करू नका.

Actual sales आधी City + Month levelवर group करा. मग targetsच्या त्याच unique keyवर merge करा; daily ordersला monthly target जोडून targetची Sum केल्यास repeated targetsमुळे total फुगू शकतो.

Reverse transformationसाठी Transform › Pivot Column. एकाच City/Monthचे अनेक rows असतील तर योग्य aggregation ठरवावी लागते.

Practice

Monthly target sheet unpivot करा, real Month Start date बनवा, actual monthly summaryशी merge करा. Missing actuals आणि missing targets वेगळे flag करा.

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

Unpivot Other Columns नवीन monthला घेऊ शकतो, पण नवीन Notes columnही घेईल. Identifier/metadata columns आणि expected month names refreshवेळी तपासा.
