<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Help needed to pass a dynamic parameter value to a dataset when embedding a report in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3300409#M43217</link>
    <description>&lt;P&gt;Hi, I have a dataset that is the result of a stored procedure accepting an input parameter value.&lt;/P&gt;&lt;P&gt;First, I have no issue to embed the report using JavaScript. But my web application, depending on the case, passes in a different parameter value that should be used by the sp. I am hoping to pass this value to the sp to each time get a different set of data (the schema is the same). I read the Dynamic M query parameters in Power BI Desktop article. But I am confused, in Power BI Desktop, I could not find the "Bind to parameters" in Model View when following the steps to set up my list table.&lt;/P&gt;&lt;P&gt;What do I do wrong? I have Power BI Desktop&amp;nbsp;Version: 2.118.828.0 which should be the latest.&lt;/P&gt;&lt;P&gt;Or do you have other suggestion to achieve my goal, which is to use the dataset that accepts a dynamic parameter value when the report is embedded by the web application?&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2023 20:18:07 GMT</pubDate>
    <dc:creator>StephenL_CA</dc:creator>
    <dc:date>2023-06-23T20:18:07Z</dc:date>
    <item>
      <title>Help needed to pass a dynamic parameter value to a dataset when embedding a report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3300409#M43217</link>
      <description>&lt;P&gt;Hi, I have a dataset that is the result of a stored procedure accepting an input parameter value.&lt;/P&gt;&lt;P&gt;First, I have no issue to embed the report using JavaScript. But my web application, depending on the case, passes in a different parameter value that should be used by the sp. I am hoping to pass this value to the sp to each time get a different set of data (the schema is the same). I read the Dynamic M query parameters in Power BI Desktop article. But I am confused, in Power BI Desktop, I could not find the "Bind to parameters" in Model View when following the steps to set up my list table.&lt;/P&gt;&lt;P&gt;What do I do wrong? I have Power BI Desktop&amp;nbsp;Version: 2.118.828.0 which should be the latest.&lt;/P&gt;&lt;P&gt;Or do you have other suggestion to achieve my goal, which is to use the dataset that accepts a dynamic parameter value when the report is embedded by the web application?&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 20:18:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3300409#M43217</guid>
      <dc:creator>StephenL_CA</dc:creator>
      <dc:date>2023-06-23T20:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to pass a dynamic parameter value to a dataset when embedding a report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3305353#M43268</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="512596" data-lia-user-login="StephenL_CA" class="lia-mention lia-mention-user"&gt;StephenL_CA&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;How did you design the report? have you parameterized your stored procedure with query parameters?&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;You should parameterize the query parameters with your stored procedure at the first. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;After you publish and embeded this report, you can use updateParameters and setFilters methods to update and interact with backend query parameters.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Sample code:&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// Get a reference to the embedded report
var report = powerbi.embed(reportContainer, config);

// Define the list of parameter values
var parameterValues = [
  {
    name: "Parameter1",
    value: "Value1"
  },
  {
    name: "Parameter2",
    value: "Value2"
  }
];

// Update the parameter values
report.updateParameters(parameterValues)
  .then(function () {
    // Set the filters based on the updated parameter values
    var filters = [
      {
        $schema: "http://powerbi.com/product/schema#advanced",
        target: {
          table: "Table1",
          column: "Column1"
        },
        filterType: 1,
        operator: "In",
        values: [parameterValues[0].value]
      },
      {
        $schema: "http://powerbi.com/product/schema#advanced",
        target: {
          table: "Table2",
          column: "Column2"
        },
        filterType: 1,
        operator: "In",
        values: [parameterValues[1].value]
      }
    ];

    // Set the filters on the report
    report.setFilters(filters);
  });&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/" target="_blank"&gt;Power BI embedded analytics Client APIs | Microsoft Learn&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 02:05:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3305353#M43268</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-28T02:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to pass a dynamic parameter value to a dataset when embedding a report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3306795#M43285</link>
      <description>&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;Now I have change mind. I use .Net SDK to do what I am trying to accomplish: update the parameter value then get the embedded report. But then I get "This operation is only supported for the dataset owner".&lt;/P&gt;&lt;P&gt;Some background info: my web app is written in C# MVC. The app is registered through Azure AD. It is a service principal , App Owns Data approach. I have the tenant id, appId, App secret. In the C# code I have the pbiClient instantiated with the proper credentials, proof is that I have no issue embedding the report to my web app. The dataset that I am trying to update the parameter, the service principal has all permissions in Power BI service on it though someone else designed the report on Power BI Desktop, thus the dataset creator or owner is that person, I am not sure if this is relevant. Here is the code snippet.&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;var updateParametersRequest = new UpdateMashupParametersRequest&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;UpdateDetails = new List&amp;lt;UpdateMashupParameterDetails&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;new UpdateMashupParameterDetails&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Name = "PortalFacilityID",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;NewValue = pbiModel.ReportParameters.Where(p=&amp;gt;p.Name.Equals("FacilityID", StringComparison.OrdinalIgnoreCase)).Select(p=&amp;gt;p.Value).FirstOrDefault().ToString(),&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;pbiClient.Datasets.UpdateParametersInGroup(workspace.Id, pbiReport.DatasetId, updateParametersRequest);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Please, help to solve the error "This operation is only supported for the dataset owner".&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PS: in the report design I have properly parametize the sp.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;let&lt;BR /&gt;facilityId = Text.From(PortalFacilityID),&lt;BR /&gt;&lt;BR /&gt;Source = Sql.Database("sac1v-sqlent-1", "DivrProd",&lt;BR /&gt;[&lt;BR /&gt;Query="exec dbo.SelectRecoveryTrendDataParameter @PortalFacilityID = ' " &amp;amp; facilityId &amp;amp; " ' "&lt;BR /&gt;]&lt;BR /&gt;)&lt;BR /&gt;in&lt;BR /&gt;Source&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 19:06:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3306795#M43285</guid>
      <dc:creator>StephenL_CA</dc:creator>
      <dc:date>2023-06-28T19:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to pass a dynamic parameter value to a dataset when embedding a report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3306869#M43286</link>
      <description>&lt;P&gt;Ok, continue on the previous reply from myself. I overcome the error by adding TakeOver()&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Also, I added RefreshDatasetsInGroup(), thinking that would refresh the report with new data loaded with the new parameter value. But no, the embedded report still has the old data. And when I go to Power Bi service the dataset I see:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Please, could you tell me what else is missing in my steps?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 19:59:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3306869#M43286</guid>
      <dc:creator>StephenL_CA</dc:creator>
      <dc:date>2023-06-28T19:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to pass a dynamic parameter value to a dataset when embedding a report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3313798#M43340</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="512596" data-lia-user-login="StephenL_CA" class="lia-mention lia-mention-user"&gt;StephenL_CA&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;The error message seems related to the data source credentials, I think you may need to re-verify them before invoke the API to refresh.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 07:41:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/3313798#M43340</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-04T07:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to pass a dynamic parameter value to a dataset when embedding a report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/4018923#M53823</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/512596" target="_self"&gt;&lt;SPAN class=""&gt;StephenL_CA&lt;/SPAN&gt;&lt;/A&gt;, I know this is an old post, did you get a final solution? thank you for the post.&lt;/P&gt;&lt;P&gt;-Peter&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 16:21:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/4018923#M53823</guid>
      <dc:creator>pcho</dc:creator>
      <dc:date>2024-07-01T16:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to pass a dynamic parameter value to a dataset when embedding a report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/4018933#M53824</link>
      <description>&lt;P&gt;Not really finding a solution, I gave up going down this path.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 16:31:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-needed-to-pass-a-dynamic-parameter-value-to-a-dataset-when/m-p/4018933#M53824</guid>
      <dc:creator>StephenL_CA</dc:creator>
      <dc:date>2024-07-01T16:31:58Z</dc:date>
    </item>
  </channel>
</rss>

