# 7.10 Columns आणि rows मध्ये Split

Source: https://ravindrabagale.com/mr/powerbi/ch07-data-cleaning-a-z-in-power-query/7-10-split-columns-all-six-methods-plus-split-into.html
Language: mr (Marathi with English technical terms)

Transform › Split Column किंवा Home मधून text चे भाग करता येतात. Delimiter, character count, positions किंवा अक्षर / digit बदलण्याची जागा वापरता येते.

 | Method
 | Before
 | After
 | Setting used

 | By Delimiter
 | BLK-PUN-KOT-01
 | BLK · PUN · KOT · 01
 | Delimiter "-", Each occurrence

 | By Number of Characters
 | BLK250314
 | BLK · 250314
 | 3 characters, Once, as far left as possible

 | By Positions
 | 20250314KOT
 | 20250314 · KOT
 | Positions 0, 8

 | By Lowercase to Uppercase
 | KothrudHub
 | Kothrud · Hub
 | –

 | By Uppercase to Lowercase
 | PUNkothrud
 | PUNk · othrud (usually not what you want)
 | –

 | By Digit to Non-Digit
 | 500ml
 | 500 · ml
 | –

 | By Non-Digit to Digit
 | Poha1kg
 | Poha · 1kg
 | –

वरील table मधले inputs व outputs sample strings आहेत. By Uppercase to Lowercase चा PUNkothrud result अपेक्षेप्रमाणे नसेल; अशा वेळी delimiter किंवा योग्य extraction निवडा.

Store ID निवडा; उदा. BLK-PUN-KOT-01.

Transform › Split Column › By Delimiter.

Custom delimiter - आणि Each occurrence निवडा.

Columns ना Platform Code, City Code, Area Code, Store No नावं द्या. Store No Text ठेवा म्हणजे 01 मधला zero टिकेल.

मूळ column हवा असेल तर आधी Duplicate Column करा किंवा Add Column › Extract वापरा.

एकाच cell मधले items वेगळ्या rows मध्ये

 | Order ID
 | Items

 | BLK-40001
 | Ladi Pav; Amul Butter; Poha

 | BLK-40002
 | Nashik Grapes

 | Order ID
 | Items

 | BLK-40001
 | Ladi Pav

 | BLK-40001
 | Amul Butter

 | BLK-40001
 | Poha

 | BLK-40002
 | Nashik Grapes

Items › Split Column › By Delimiter मध्ये ; द्या. Advanced options › Split into Rows निवडा. शेवटी Format › Trim करा.

Split = Table.SplitColumn(Source, "Store ID",
    Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv),
    {"Platform Code", "City Code", "Area Code", "Store No"})

ToLists  = Table.TransformColumns(Source, {{"Items", Splitter.SplitTextByDelimiter(";")}}),
ToRows   = Table.ExpandListColumn(ToLists, "Items"),
Trimmed  = Table.TransformColumns(ToRows, {{"Items", Text.Trim, type text}})

Practice

Pack Size मधले 500ml, 1kg, 12pcs हे By Digit to Non-Digit वापरून Size Value आणि Size Unit करा. Size Value Decimal Number करा.

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

एका order मध्ये 3 आणि दुसऱ्यात 7 items असतील तर ठरावीक split columns मध्ये अतिरिक्त भाग चुकू शकतात. Rows मध्ये split करणं अधिक योग्य. Automatic Changed Type मुळे 01 चं 1 झालं नाही ना ते तपासा.
