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.

Power BI Desktop: "-" in query parameter doesn't work when published

We faced an issue with "-" in query parameter. It works fine until you publish the reports.

 

e.g. [Query=[page-id=Text.From(pageid)]] throws an error. 

Status: New
Comments
v-haibl-msft
Employee

@dhpraveen

 

Could you please provide more detailed repro steps/screenshots? A pbix file which can be used to repro is preferred. You can upload it to file service like OneDrive and share it.

 

Best Regards,

Herbert

dhpraveen
New Member

Hi v-haibl-msft,

 

I have uploaded the pbix file to https://1drv.ms/u/s!AvO3HunjJ_s3ghT2z9caP1Kp9MIK

 

You will notice one table doesnt work and shows invalid syntax error. Let me know if you need any more details.

 

 

v-haibl-msft
Employee

@dhpraveen

 

So the issue here is that we cannot use “-” in query parameter, or it will show “Expression.SyntaxError: Invalid identifier.”.

Source = Json.Document(Web.Contents("http://dbbackups.cloudapp.net:8077/api/Project/GetQueryParameterInformation",[Query=[Project-Id=Text.From(5)]]))

 

If we do not use “-” in query parameter as below, it will not show SyntaxError.

Source = Json.Document(Web.Contents("http://dbbackups.cloudapp.net:8077/api/Project/GetQueryParameterInformation",[Query=[ProjectId=Text.From(5)]]))

 

Is it right?

 

Best Regards,

Herbert

dhpraveen
New Member

@v-haibl-msft, yes, if we do not use "-" in query parameter it works. But the API we need to consume has a parameter with "-" in it and we dont have an option to get it updated by the API owners. Do we have a work around for this?

 

On the other hand if we use the below syntax, it doesn't work when we publish the PBIX to web.

 

Source = Json.Document(Web.Contents("http://dbbackups.cloudapp.net:8077/api/Project/GetQueryParameterInformation?Project-Id=5")

v-haibl-msft
Employee

@dhpraveen

 

I can repro the SyntaxError issue while using “-“ in query parameter as below.

Source = Json.Document(Web.Contents("http://dbbackups.cloudapp.net:8077/api/Project/GetQueryParameterInformation",[Query=[Project-Id=Text.From(5)]]))

 

I’ve reported it to Power BI team internally: CRI 27507907. I’ll post here if I get any update for it.

 

But I can publish the report to Service successfully while using “-“ in query parameter as below. I did not make any change to your shared PBIX file before publish.

Source = Json.Document(Web.Contents("http://dbbackups.cloudapp.net:8077/api/Project/GetQueryParameterInformation?Project-Id=5")

Power BI Desktop in query parameter doesn't work when published_1.jpg

 

Best Regards,

Herbert

v-haibl-msft
Employee

@dhpraveen

 

Identifiers which contain special characters have to be quoted. The right syntax is [Query=[#"Project-Id"=Text.From(5)]] That is, the identifier name is surrounded with double-quotes and prefixed with a '#'.

 

Best Regards,

Herbert