Skip to content
Advertisement

How to pass parameter from JS to Power bi embedded?

Is it possible to passing parameter from JS to power bi ? EX: power query :

    Source = Json.Document(Web.Contents("host/api/getProductReportConfig",
        [
            Query=
            [
                productId=productId
            ]
        ])),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "productId", "pathId", "type", "report_level"}, {"Column1.id", "Column1.productId", "Column1.pathId", "Column1.type", "Column1.report_level"})
in
    #"Expanded Column1"

param productId i want send it from JavaScript

Thanks !!!

Advertisement

Answer

No, it is not possible. Lets say 2 or more users are viewing this report simultaneously. The data returned from the host must be imported in the report’s dataset, but both users are viewing the same report, i.e. using the same dataset. So it is not possible to do that.

You have two options – either import the data for all possible products in the dataset, and then apply a filter when embedding the report, or duplicate the report as many times as needed, update the parameter value in each of them to a different product, and decide later which one to embed and present to the user.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement