Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: Ada_net 25 ani
 | Femeie 25 ani Bucuresti cauta Barbat 25 - 47 ani |
|
|
TRaP
Moderator
Inregistrat: acum 8 ani
Postari: 931
|
|
I needed this in a small query to match a much larger query.
The main (large) query has zeroes added in front of some codes (column format is Text). The small query didn't have that. The main query has 0 added in front of the text up to 10 characters in total, while the small query is missing the zeroes.
For example, a string from small query would be 123456, and the main query equivalent would be 0000123456. Similarly, for a string from small query 100006587, the main query would have 0100006587. And so on.
This can be done in 2 ways:
1. Custom column (this adds "0" in front of the strings in [My code] column up to the 10 characters specified in the formula.
| =Text.PadStart([My code], 10, "0") |
Note: to add text in the end, simply change the function from Text.PadStart to Text.PadEnd.
2. Pad directly on the [My code] column in the small query
Right click on the last step (or desired step), and select Insert step after - if the step is added between 2 existing steps (not after last step), you will be asked to confirm the insertion - click the Insert button
The inserted step will contain the formula: =#"Previous step" where "Previous step" is the name of the previous step.
Copy the name of the previous step (#"Previous step") and input it in the following formula:
= Table.TransformColumns( #"Previous step", {{"My codes", each Text.PadStart(_, 10, "0"), type text}} ) |
E.g., for a real query it could be:
= Table.TransformColumns( #"Changed Type", {{"My codes", each Text.PadStart(_, 10, "0"), type text}} ) |
|
|
| pus acum 11 zile |
|