Forum Discussion
List Parameter only passes Current Value
- Anonymous3 years ago
Do you need to create a parameter for this? I'm not at my desk, but can't you just replace
& Number.ToText(CampaignIDParameter)
with
& each Number.ToText([CampaignID])
--Nate
Do you need to create a parameter for this? I'm not at my desk, but can't you just replace
& Number.ToText(CampaignIDParameter)
with
& each Number.ToText([CampaignID])
--Nate
Hello Anonymous and AlexisOlson ,
Thanks very much for your replies. For some reason I thought a parameter was necessary here but I'm glad to be corrected.
I tried replacing the parameter call in this function with the value ID from the row as Nate suggested but was hit with
Expression.SyntaxError: Token Literal Expectedat the "each" keyword, so I wrapped it in parenthesis:
() => let
Source = Xml.Tables(Web.Contents("https://webapi.urlexample.com/webapi/v01.0/eobjects/XMLData/" & "CampaignOpenClickDetails/" & (each Number.ToText([CampaignId]) & "?pageon=1....and was then hit with
An error occurred in the 'Campaign Data function' query. Expression.Error: We cannot apply operator & to types Text and Function.
Details:
Operator-&
Left=https://webapi.urlexample.com/webapi/v0.1.0/eobjects/XMLData/CampaignOpenClickDetails/
Right=[Function]I'm sure there is some silly syntactical mistake I'm overlooking here but I'm not well-versed enough in M to recognize it.
- Anonymous3 years agoNot applicable
I figured it out. I was trying to add & each Number.ToText([CampaignID]) to the function when really I needed to scrap the function altogether and just put it into the custom column query itself. Also, Power BI didn't like me using Number.ToText but when I changed the CampaignID column data type to Text pre-emptively and THEN referenced those values in the custom column, it worked. Thank you Anonymous and AlexisOlson for sending me down the right path!