Forum Discussion

Hugo_Gallardo's avatar
5 years ago
Solved

Power BI Embedded: Problem using more than one filter on the same Embedded exporting all the Visuals

We are facing the following problems using more than one filter in our development.   We are using ASP.net core 3.0, Razor and Bootstrap 4.   Scenario:   We have extracted every single visual ...
  • Hugo_Gallardo's avatar
    4 years ago

    Hi, we solved it it was the [] characters when sending the filter.

     

    I attach the solution!! Thanks!

     

    function ReplaceFilters() {
    //var a = $("#In1").val();
    //var b = $("#In2").val();
    const filterList = [{
    $schema: "http://powerbi.com/product/schema#basic",
    target: {
    table: "tCalendarioNestleN",
    column: "SemanaNestle"
    },
    logicalOperator: "And",
    conditions: [{
    operator: "GreaterThanOrEqual",
    value: 1
    }, {
    operator: "LessThanOrEqual",
    value: 5
    }]
    },
    {
    $schema: "http://powerbi.com/product/schema#basic",
    target: {
    table: "tProductos",
    column: "cveCategoria"
    },
    operator: "In",
    values: ["PURINA"]
    }];

    var embedContainerPortafolio = $('#TendenciaSOut')[0];
    var reportPortafolio = powerbi.get(embedContainerPortafolio); // Replace all report's filters.

    try {
    reportPortafolio.setFilters( filterList);
    // reportPortafolio.setFilters([filterList]); this was the one you sent us.
    } catch (errors) {
    console.log(errors);
    }
    /* catch (errors) { console.log(errors); }*/
    }