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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jagostinhoCT
Post Partisan
Post Partisan

Token Comma Expected

hello,

 

I'm new to coding in Power Query.

I tried adding the last line #"Padded Values" to the existing code but I am getting the Token Comma expected error.

 

Can someone please explain why?

Thank you

 

 

let
    Source = Excel.Workbook(File.Contents(XLS), null, true),
    Areas_Sheet = Source{[Item="Areas",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Areas_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"AreaScheme", type text}, {"Level", type text}, {"Number", type text}, {"Name", type text}, {"Area", type number}, {"CTA.ZoneCode", type text}}),
    #"Inserted Last Characters" = Table.AddColumn(#"Changed Type", "Last Characters", each Text.End([Level], 2), type text),
    #"Renamed Columns" = Table.RenameColumns(#"Inserted Last Characters",{{"Last Characters", "LevelPrefix"}})
    #"Padded Values" = Text.PadStart(#"Padded Values",[Level Prefix],5,"0")
in
    #"Padded Values"

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

All steps except the last need a comma after them.  Add a comma at the end of your #"Renamed Columns" step.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
Anonymous
Not applicable

HI I am new to coding in Power Query. I am 

I am getting the Token Comma expected error.

Can someone please explain why?

Thank you

let bernDistAna = (hitNum) => {
let p = sum(hitNum)/count(hitNum);
return hitNum * (1 - p);
};

 

mahoneypat
Employee
Employee

Your last step is referencing itself (so that variable doesn't exist yet).  Change it to reference your previous step.

 #"Padded Values" = Text.PadStart(#"Renamed Columns",[Level Prefix],5,"0")




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


jagostinhoCT
Post Partisan
Post Partisan

Thank you @mahoneypat 

 

But now I am getting the following error.

Expression.Error: The name 'Padded Values' wasn't recognized. Make sure it's spelled correctly.

 

 

mahoneypat
Employee
Employee

All steps except the last need a comma after them.  Add a comma at the end of your #"Renamed Columns" step.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.