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.
I'm sucessfully passing a Parameter into my Power Query SQL statements.
An example of the M code to reference a Parameter:
p.CreateDateUTC >= '"&StartDT&"'
And the parameter itself:
And I have a query to determine what the StartDT should be:
I can't seem to get my Parameter, to automatically update though. Instead I just take note of the value, then update the Parameter myself under 'Current Value'
?
Solved! Go to Solution.
Usually you need a format like YYYY-MM-DD, but get it working with a hard-code value and then reproduce that using Date.ToText( ), if needed. Then you just reference the query name, not the step name. In your case,
pCreateDateUTC<" & RevEndDt
If there is more after that, you can concatenate that with & "rest of sql expression"
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Instead of using a parameter, you can have the output of a query to be a text value. Use your first parameter in a query, create the text string you need, and then use that query instead of the parameter instead of the 2nd parameter.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks.
So for converting my query to text - like this? I converted to date first (to remove the time portion of the datetime), then converted to text, then drilled down.
But then, - since my query is all in SQL, I'm not sure how to reference that value in the M Code?? Referencing the Parameter works like this:
p.CreateDateUTC <'&"EndDT"&'
But referencing this text value, I'm not clear the syntax?
Usually you need a format like YYYY-MM-DD, but get it working with a hard-code value and then reproduce that using Date.ToText( ), if needed. Then you just reference the query name, not the step name. In your case,
pCreateDateUTC<" & RevEndDt
If there is more after that, you can concatenate that with & "rest of sql expression"
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks, Date.ToText( ) is what i needed, specifically this format:
'"&Date.ToText(RevEndDT)&"'
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
48 | |
19 | |
13 | |
11 |