8. Adding Columns: Power Query Add Column Tab and DAX Calculated Columns
8.6 Index Column
Add Column › Index Column › From 0 / From 1 / Custom… (Custom lets you choose the Starting index and Increment, e.g. start 1001, step 1).
| Use | Example |
|---|---|
| Row number for tracing | Row 57 of the Pune file has a bad date |
| Surrogate key | Create a Store Key for a store list that has no ID |
| Previous-row comparisons | Add Index From 0 and From 1, then merge the table with itself to compare each order with the previous order of the same rider |
| Sort order | Keep the original order of a festival list |
Ravindra Bagale's Tip
Friends, pay attention: an index added after sorting or filtering changes whenever the data changes, so don't use it as a permanent key. Add the index where the order is meaningful. Remember, adding an index usually stops query folding, so put it as late as possible. Try it once more, then move on.
Ravindra Bagale's Tip – मराठी
मित्रांनो, लक्ष द्या: sort किंवा filter केल्यानंतर जोडलेला index data बदलला की बदलतो, म्हणून तो कायमची key म्हणून वापरू नका. जिथे order ला अर्थ आहे तिथे index जोडा. लक्षात ठेवा, index जोडल्याने साधारणपणे query folding थांबतं, म्हणून तो शक्य तितक्या उशिरा ठेवा. पुन्हा एकदा करून बघा, मग पुढे जा.
Ravindra Bagale's Tip – हिंदी
दोस्तों, ध्यान दो: sort या filter के बाद जोड़ा गया index data बदलते ही बदल जाता है, इसलिए उसे स्थायी key मत बनाओ. Index वहाँ जोड़ो जहाँ order का मतलब हो. याद रखो, index जोड़ने से आमतौर पर query folding रुक जाता है, इसलिए उसे जितना हो सके बाद में रखो. एक बार फिर करके देखो, फिर आगे बढ़ो.