Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |