Power BI आपोआप data types बदलतो ते कसं थांबवायचं आणि slow loading कसं fix करायचं
तुम्ही CSV उघडता आणि Power BI ने आधीच तुमच्यासाठी एक Changed Type step add केलेली असते. त्याने पहिल्या rows बघून types चा अंदाज लावलेला असतो, म्हणून खाली NA असलेल्या price column मध्ये errors येतात, आणि प्रत्येक fix त्या step ला delete करण्यापासून सुरू होतो. मग file मोठी झाली की Close & Apply ला जास्त जास्त वेळ लागतो. या chapter मध्ये आपण Power BI ला types चा अंदाज लावणं थांबवायला सांगणार, types स्वतः योग्य क्रमाने set करणार, Applied Steps ची list clean ठेवणार, 2025 ची file sales मध्ये append करणार, आणि loading slow करणारी एक setting बंद करणार.
या chapter मध्ये काय शिकणार
- CSV files साठी Never detect column types
- GLOBAL आणि CURRENT FILE options
- Blank आणि null: type च्या आधी आणि नंतर
- आधी replace, मग type
- Latest data शेवटच्या step ला
- पुढचं वर्ष sales मध्ये append
- Relationship autodetect बंद
Practice files: blinkit-orders-2025-small.csv (या page वरचे 3 rows) आणि blinkit-orders-2025.csv (150 rows). Power BI Power Query मध्ये अनेक वर्षांचा sales data append कसा करायचा मधली sales query पण लागेल.
Made-up data: Maharashtra मधल्या शहरांचे काल्पनिक Blinkit-style orders, फक्त practice साठी. Amounts ₹ मध्ये.
1. Problem काय आहे
2025 च्या file मध्ये काही नवीन गोंधळ आहेत:
| order_id | product_id | city | order_date | order_date_2 | sales | price | revenue | stock |
|---|---|---|---|---|---|---|---|---|
| BLK5001 | P103 | Nashik | (empty) | 14-01-2025 | (blank) | 90 | (blank) | (blank) |
| BLK5002 | P102 | Chhatrapati Sambhajinagar | (empty) | 22-04-2025 | 2 | 450 | 900 | 11 |
| BLK5003 | P105 | Pune | (empty) | 05-08-2025 | 1 | NA | 999 | 6 |
(File मध्ये store_id, रिकामा promo_bin column आणि delivery_date पण आहेत.)
order_dateरिकामा आहे; खरी dateorder_date_2मध्ये आहे.- काही sales, revenue आणि stock cells blank आहेत.
- एक price NA आहे.
Automatic type detection चालू असेल तर Power Query load झाल्या झाल्या Changed Type step add करतो. त्याने price number ठरवला, तर तुम्ही clean करायच्या आधीच NA चा Error होतो.
2. सोप्या भाषेत idea
CSV आणि text files साठी (Power BI त्यांना unstructured sources म्हणतो) Power Query पहिले 200 rows बघून प्रत्येक column च्या type चा अंदाज लावतो. नीट file साठी अंदाज चालतो. Messy file साठी तो सापळा आहे, कारण type change तुमच्या cleaning च्या आधी होतो.
म्हणून अंदाज बंद करा आणि एकच ठरलेला क्रम पाळा:
- Headers स्वतः promote करा.
- Columns remove आणि rename करा.
- NA सारखा text null ने replace करा.
- Types सगळ्यात शेवटी.
या chapter मधल्या अजून दोन ideas:
- Blank आणि null. Text column मध्ये रिकामा cell blank दिसतो. Column number type केल्यावर तोच cell null दिसतो. Number columns मधले blanks replace करायची गरज नाही; type change ते करतो.
- Applied Steps वरून खाली चालतात. Latest data नेहमी शेवटच्या step ला असतो. खाली काम करा; मधल्या जुन्या steps edit करू नका.
Figure 1. Detection चालू असेल तर Changed Type cleaning आधी चालतो आणि NA चा Error होतो; बंद असेल तर आधी NA ऐवजी null आणि types शेवटी (चित्र).
3. Data
3 rows साठी प्रत्येक cell step by step काय होतो:
| order_id | sales (text म्हणून) | sales (Whole Number) | price (text म्हणून) | NA → null आणि Decimal नंतर price |
|---|---|---|---|---|
| BLK5001 | (blank) | null | 90 | 90 |
| BLK5002 | 2 | 2 | 450 | 450 |
| BLK5003 | 1 | 1 | NA | null |
हे 3 rows sales च्या 7 rows ला append केल्यावर:
| Check | हाताने |
|---|---|
| Rows | 7 + 3 = 10 |
| Revenue | 2,634 + 900 + 999 = ₹4,533 (BLK5001 चा revenue null) |
| Sales (units) | 14 + 2 + 1 = 17 |
4. Step by step
Type detection बंद करा
- File › Options and settings › Options.
- GLOBAL खाली Data Load वर click करा. Type Detection मध्ये Never detect column types and headers for unstructured sources निवडा. हे नवीन files ना लागू होतं.
- CURRENT FILE खाली Data Load वर click करा. Type Detection मध्ये Detect column types and headers for unstructured sources untick करा. हे उघड्या file ला लागू होतं. OK.
2025 file load करा
- Power Query उघडायला Home › Transform data, मग Home › New Source › Text/CSV ›
blinkit-orders-2025-small.csv› OK. Query चं नावorders_2025करा. - Applied Steps बघा: फक्त Source. Columns Column1, Column2 … आहेत आणि Changed Type step add झालेली नाही.
- Home › Use First Row as Headers. त्याखाली तरीही Changed Type step आली, तर तिच्या ✕ वर click करून delete करा.
योग्य क्रमाने clean करा
- order_id आणि product_id filter arrow ने check करा (Load more दिसलं तर click करा) आणि (blank) व NA untick करा.
- रिकामे order_date आणि promo_bin columns remove करा. order_date_2 चं नाव
order_dateकरा. - sales, revenue आणि stock बघा: रिकामे cells blank दिसतात. तसेच राहू द्या.
- price वर right-click › Replace Values › Value To Find
NA, Replace Withnull› OK. - आता types set करा: order_date आणि delivery_date › Change Type › Using Locale › Date, English (India); sales आणि stock › Whole Number; price आणि revenue › Decimal Number. BLK5001 चे blank sales, revenue आणि stock cells आता null दिसतात.
sales मध्ये append करा
salesquery निवडा. Home › Append Queries (साधं) › Two tables › Table to append:orders_2025› OK.orders_2025वर right-click › Enable load untick करा.
Loading fast करा
- File › Options and settings › Options › CURRENT FILE › Data Load. Relationships खाली Autodetect new relationships after data is loaded untick करा. OK.
- Home › Close & Apply.
Figure 2. Options window: GLOBAL settings नवीन files ना, CURRENT FILE settings उघड्या file ला; Type Detection आणि Relationships options Data Load खाली (चित्र).
5. Result असा दिसायला हवा
orders_2025 चे Applied Steps: Source › Promoted Headers › Filtered Rows › Removed Columns › Renamed Columns › Replaced Value › Changed Type (नावांना Changed Type1 सारखे numbers असू शकतात). sales मध्ये 10 rows:
| Check | Value |
|---|---|
| Rows | 10 (2023 चे 4, 2024 चे 3, 2025 चे 3) |
| Total revenue | ₹4,533 |
| Total sales | 17 units |
| Nulls | sales 1, price 2, revenue 1, stock 1 |
| Errors | प्रत्येक column मध्ये 0 (View › Column quality) |
6. काय झालं
- Detection बंद असल्यामुळे कोणीच types चा अंदाज लावला नाही, म्हणून price मधला NA replace करेपर्यंत text च राहिला. Error कधी आलाच नाही.
- Replace नंतर number types set केल्यावर NA (आता null) आणि blank cells null झाले. Blank म्हणजे फक्त "empty text"; number म्हणून तो फक्त null असू शकतो.
salesमध्ये append केल्यावरsalesquery च्या तळाशी एक step add झाली.orders_2023,orders_2024आणिorders_2025तिला data देतात; load फक्तsalesहोते.- Autodetect relationships मुळे प्रत्येक load नंतर Power BI loaded tables मध्ये matching column names शोधतो. एकच loaded table असेल तर शोधायला काही नाही, आणि मोठ्या files मध्ये हा scan वेळ खातो.
Classroom line
Whenever any error appears, first delete the Changed Type step.
Class मधलं वाक्य
"kadhi bi kahi bi error ala, pahilyanda to change type vala jo kahi step ahe to delete marayacha"
कधीही कोणताही error आला, तर पहिल्यांदा तो Changed Type वाला step delete करायचा.
Classroom line
Whenever any error appears, first delete the Changed Type step.
7. अजून थोडं खोलात
- Latest data शेवटच्या step ला. जुन्या step वर click केलं की त्या वेळचा data दिसतो. जुनी step selected असताना नवीन step add केली, तर Power Query ती मध्ये Insert करायची का विचारतो; मग पुढच्या steps तुटू शकतात. काम करण्याआधी शेवटची step निवडा.
- जुन्या step च्या formula मध्ये rename करू नका. पुढच्या steps columns ना नावाने ओळखतात; मध्येच rename केलं तर The column … of the table wasn't found error येतो.
- List गोंधळलेली असेल, तर Source पर्यंत steps delete करा (step वर right-click › Delete Until End) आणि क्रमाने परत करा. छोट्या file साठी हाच बहुतेक सगळ्यात fast उपाय असतो.
- GLOBAL आणि CURRENT FILE. GLOBAL options म्हणजे यापुढे बनवणार त्या files साठी तुमचे defaults. CURRENT FILE options .pbix च्या आत save होतात आणि file सोबत colleague कडे जातात.
- Relationships options. Microsoft Data Load › Relationships खाली तीन options documented करतो: Import relationships from data sources on first load, Update or delete relationships when refreshing data, आणि Autodetect new relationships after data is loaded. काही versions मध्ये Relationships options GLOBAL › Data Load खाली पण दिसतात, जिथे ते नवीन files साठी default असतात; तुमची स्वतःची Options window check करा.
- आधीच्या chapter मधला error चा नियम अजूनही लागू. Number type set केल्यावर Error आला, तर ती Changed Type step delete करा, text replace करा, मग परत type set करा. बघा Power Query मधला DataFormat.Error We Couldn't Convert to Number कसा fix करायचा.
Classroom line
Your latest data is always at the last step.
Class मधलं वाक्य
"Tumcha latest data always last step la asto."
तुमचा latest data नेहमी शेवटच्या step ला असतो.
Classroom line
Your latest data is always at the last step.
8. नेहमीच्या चुका
| चुकीचा result | कारण | उपाय |
|---|---|---|
| Load नंतर तरीही Changed Type step येते | फक्त GLOBAL option बदलला; उघड्या file मध्ये detection अजून चालू | CURRENT FILE खाली पण untick करा, आणि step delete करा |
| BLK5003 साठी price मध्ये Error | NA replace करण्याआधी type set केला | ती Changed Type step delete करा, NA ऐवजी null, परत type set करा |
| Blank sales cells 0 ने replace केले | Blanks ना zero समजलं | तसेच ठेवा; number type त्यांना null करतो |
sales मध्ये order_date आणि order_date_2 दोन्ही |
order_date_2 rename केला नाही, किंवा रिकामा order_date काढला नाही | रिकामा column काढा, order_date_2 चं नाव order_date करा |
| पुढची step column wasn't found ने fail होते | जुन्या step मध्ये rename केलं | तिथे undo करा आणि rename तळाशी नवीन step म्हणून करा |
| 10 ऐवजी 13 rows | orders_2025 दोनदा append झाली, किंवा "as New" करून परत append केलं |
sales मधली Append step check करा; एकच ठेवा |
Ravindra Bagale's Tip
Make the Applied Steps list read like a recipe: headers, remove, rename, replace, types, append. If you cannot read it top to bottom and understand it, it is time to delete back to Source and redo it cleanly.
Ravindra Bagale's Tip – मराठी
Applied Steps ची list recipe सारखी वाचता आली पाहिजे: headers, remove, rename, replace, types, append. वरून खाली वाचून समजत नसेल, तर Source पर्यंत delete करून परत नीट करायची वेळ आलीय.
Ravindra Bagale's Tip – हिंदी
Applied Steps की list recipe की तरह पढ़ी जानी चाहिए: headers, remove, rename, replace, types, append. ऊपर से नीचे पढ़कर समझ न आए, तो Source तक delete करके फिर से साफ़ बनाने का समय आ गया है.
9. स्वतः practice करा
Practice task
आधीच्या chapter मधल्या 255-row sales सोबत, type detection बंद ठेवून blinkit-orders-2025.csv load करा, clean करा आणि append करा.
- ID checks नंतर
orders_2025मध्ये किती rows राहतात? - त्यात sales, price, revenue आणि stock मध्ये किती nulls?
- आता
salesमध्ये किती rows, आणि total revenue किती?
Hints: 4 rows मध्ये product_id NA आहे. Blank sales, revenue आणि stock cells ना replace लागत नाही.
Solution बघा
- 146 rows (150 − 4).
- sales 9, price 9, revenue 10, stock 7 nulls.
salesमध्ये 401 rows (120 + 135 + 146). Revenue ₹1,95,016 (2023: 53,186 · 2024: 70,636 · 2025: 71,194). Sales 860 units.
10. Professional सारखा विचार करा
- Business view. चुकीचे types शांतपणे चूक करतात: text म्हणून ठेवलेला revenue column Sum ऐवजी Count देतो. Types स्वतः, ठरलेल्या step ला set केले की अंदाज संपतो.
- Performance. कमी आणि विचारपूर्वक steps fast refresh होतात. Relationship autodetect आणि Auto date/time दोन्ही प्रत्येक load ला काम वाढवतात; वापरत नाही ते बंद करा.
- Maintenance. महत्त्वाच्या steps rename करा (right-click › Rename: "Replaced NA in price", "Set types"). मग प्रत्येक वर्षाची query सारखीच वाचता येते.
- Team settings. CURRENT FILE options .pbix सोबत जातात; GLOBAL options जात नाहीत. Colleague ने तुमची file उघडली की त्याच्या settings लागू होतात.
Interview questions
- CSV files साठी Power BI आपोआप Changed Type add करतो ते कसं थांबवता? Options › GLOBAL › Data Load › Type Detection › Never detect…, आणि उघड्या files साठी CURRENT FILE option untick.
- एकच blank cell एका step ला blank आणि पुढच्या step ला null का दिसतो? Text column मध्ये तो empty text असतो; number type नंतर तो फक्त null असू शकतो.
- Applied Steps मध्ये latest data कुठे असतो? शेवटच्या step ला.
- Loading slow करणारी एक setting सांगा. Autodetect new relationships after data is loaded.
Recap
थोडक्यात
- CSV files साठी Never detect column types and headers निवडा.
- क्रम: headers, remove, rename, NA ऐवजी null, types शेवटी.
- Number columns मधले blanks आपोआप null होतात.
- शेवटच्या step वर काम करा; list गोंधळली तर Source पर्यंत delete करा.
- orders_2025 sales मध्ये append करा; fast loading साठी relationship autodetect बंद करा.
उजळणी card