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
phillip_from_oz
Frequent Visitor

Power Query Advanced Editor Syntax error

Hi everyone,
I have a syntax error on this code line and I've looked at it many times but I fail to see what is wrong.

 

Can someone please help?

let
source=Csv.Document(File.Contents("c:\temp\01-January.csv"), [Delimiter=",", Columns=12, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers"=Table.PromoteHeaders (Source, [PromoteAllScalars=true]),
#"Replaced Value" =Table.ReplaceValue(#"Promoted Headers”, "", null, Replacer.ReplaceValue, {"Month"})
in
Source

The error says "Token comma expected" and it points to the {"Month"} as shown in picture

phillip_from_oz_0-1642582250206.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@phillip_from_oz , when you have used #"Promoted Headers"  , check that double quotes are different on both side. correct it once and try. Check example below

 

let
source=Csv.Document(File.Contents("c:\temp\01-January.csv"), [Delimiter=",", Columns=12, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers"=Table.PromoteHeaders (Source, [PromoteAllScalars=true]),
#"Replaced Value" =Table.ReplaceValue(#"Promoted Headers", "", null, Replacer.ReplaceValue, {"Month"})
in
Source

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@phillip_from_oz , when you have used #"Promoted Headers"  , check that double quotes are different on both side. correct it once and try. Check example below

 

let
source=Csv.Document(File.Contents("c:\temp\01-January.csv"), [Delimiter=",", Columns=12, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers"=Table.PromoteHeaders (Source, [PromoteAllScalars=true]),
#"Replaced Value" =Table.ReplaceValue(#"Promoted Headers", "", null, Replacer.ReplaceValue, {"Month"})
in
Source

Thanks.
I must have stared at that code for hours!

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.