# 9.6 Source.Name वरून month आणि transaction categories

Source: https://ravindrabagale.com/mr/powerbi/ch09-get-data-from-folder-monthly-bank-statements/9-6-add-month-from-source-name-and-categorise.html
Language: mr (Marathi with English technical terms)

Combined Bank Transactions query मध्ये Source.Name उदा. Jan.xlsx असतो.

Source.Name › Add Column › Extract › Text Before Delimiter › dot; नाव Month.

Month No साठी List.PositionOf({"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}, [Month]) + 1 वापरा. Unknown नावासाठी 0 येऊ शकतो; तो flag करा.

वर्षही टिकवण्यासाठी 2025-01.xlsx अशी naming पद्धत अधिक स्पष्ट. Transaction month Date table मधून काढता येतो.

Mode conditional column: Narration begins UPI / NEFT / IMPS / ATM; बाकी Other.

Category keywords वर बनवा. अनेक rules असतील तर mapping table वापरा.

Combined query मधला जुन्या column नावांचा Changed Type step दुरुस्त करा.

Month    = Table.AddColumn(Src, "Month", each Text.BeforeDelimiter([Source.Name], "."), type text),
Mode     = Table.AddColumn(Month, "Mode", each Text.BeforeDelimiter(Text.Upper([Narration]), "/"), type text),
Category = Table.AddColumn(Mode, "Category", each
              let n = Text.Upper([Narration]) in
              if Text.Contains(n, "BLINKIT") or Text.Contains(n, "AMAZON NOW") then "Quick Commerce"
              else if Text.Contains(n, "SALARY") then "Salary"
              else if Text.StartsWith(n, "ATM") then "Cash Withdrawal"
              else if Text.Contains(n, "RENT") then "Rent"
              else "Other", type text)

Total Spend    = SUM('Bank Transactions'[Debit])
Total Income   = SUM('Bank Transactions'[Credit])
Net Savings    = [Total Income] - [Total Spend]
Quick Commerce Spend = CALCULATE([Total Spend], 'Bank Transactions'[Category] = "Quick Commerce")

Code मधला Text.BeforeDelimiter Mode sample UPI/NEFT narrations साठी आहे. ATM WDL मध्ये slash नसतो; म्हणून वरच्या begins-with rules ने ATM वेगळं हाताळा. Null narrationsसाठी guard द्या.

Total Spend = Debit sum; Total Income = Credit sum; Net Savings हा दोन्हींचा फरक. Bank transfer / refund मुळे credit म्हणजे नेहमी income आणि debit म्हणजे नेहमी खर्च असेलच असं नाही; या practice metric ची व्याप्ती स्पष्ट ठेवा.

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

Statement month आणि transaction month वेगळे असू शकतात. कोणता प्रश्न सोडवायचा ते ठरवा. प्रत्येक file load झाली का तपासेपर्यंत Source.Name ठेवा.
