Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Expression.SyntaxError: Token RightParen expected. // Needing Help with a custom function

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.

 

neardll_0-1657288098448.png

 

 

 

1 ACCEPTED SOLUTION

It needs to go at the very end of the line, not in the middle

View solution in original post

6 REPLIES 6
Alexis_Sawyer
New Member

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

HotChilli
Super User
Super User

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

Anonymous
Not applicable

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?

johnt75
Super User
Super User

You're missing the ) at the very end to close the Table.AddColumn function

Anonymous
Not applicable

it still shows the error and now at the added ( 

neardll_0-1657290683444.png

 

It needs to go at the very end of the line, not in the middle

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Top Solution Authors
Top Kudoed Authors