Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi there, so i'm writing this simple code to help me out with a problem when dealing with a Sheet..
So i have this 8 format number like this for example : 04777020 where i need to convert into a Postal code format like this 04777-020
But the thing is, some of the numbers lost the 0 which can usually be in front of the Postal Code, leaving it only with length of 7... soo i need to add this 0 again in the front of the code and i Need to add the 0 and add the - after the number in the 5th position, how can i do it?
Until now i writed this
= Table.AddColumn(#"Changed Type1", "Custom", each if Text.Length([CEP]) = 8 then Text.Insert([CEP],5,"-") else Text.Insert([CEP],1,"0")
ChangedType 1 is where i changed the column format to Text and [CEP] is where my codes are. and this error is showing up
Expression.SyntaxError: Token RightParen expected.
Solved! Go to Solution.
It needs to go at the very end of the line, not in the middle
Hola,
Tengo la siguiente consulta con el error " Se esperaba el token RightParen" en la coma marcada en rojo. Por favor ayúdenme a resolverlo.
la consulta es:
Origen = Odbc.DataSource("dsn=IWS", [HierarchicalNavigation=true]),
dbo_Schema = Origen{[Nombre="dbo",Kind="Esquema"]}[Datos],
Ges_OrdenesCompra_Table = dbo_Schema{[Nombre="Ges_OrdenesCompra",Kind="Tabla"]}[Datos],
Table.SelectRows = (Ges_OrdenesCompra_Table , cada [dato] >= #datetime(2022, 1, 1, 0, 0,0)),
Table.SelectColumns = (Filas filtradas, {"VendAccount", "VendName"})
Columnas filtradas
We've all done it and you're going to kick yourself when you solve it.
If I said Right paren means right bracket or closing bracket ......
---
As to the algorithm, I have 2 suggestions:
1. Maybe use Add column ->Column from examples to see if powerbi can help.
2. If you don't get it that way, have a look at Text.PadStart() function
Good luck
Thanks for your reply, i'll have a look in your sugestions and about the sugestions
1 - Soo.. i've tried the column from examples and it kinda worked for some values, but not for all fo them. Most because there are some codes that start with 2 zeros.. or 3, or 4 or even that start with 0 and then add a normal number like 1... soo it creates a lot of variants that PBI cant figure out what to do since if it starts with an 0 he automatically discart the number. Also, I could adapt all these variants one by one, but the problem is that pbi in this add column by examples have a limited visualization where i cant solve all of these
2 - the point is using Text.PadStart instead of Text.Insire?
You're missing the ) at the very end to close the Table.AddColumn function
it still shows the error and now at the added (
It needs to go at the very end of the line, not in the middle
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
18 | |
10 | |
9 | |
9 | |
8 |
User | Count |
---|---|
17 | |
16 | |
14 | |
12 | |
12 |