React power bi client filter giving error {message: 'undefined property is invalid'}. How to fix it?

761 views Asked by At

Getting this error message when I was using filterType:2 [ { "message": "undefined property is invalid" } ]

1

There are 1 answers

0
iamdhariot On

import { PowerBIEmbed } from "powerbi-client-react"; //power bi react client
import { models } from "powerbi-client"; //powerbi react client models
//powerbi component
export const PowerBiUi=()=>{
return(
<div className="container">
<PowerBIEmbed
  scroll="no"
  cssClassName={"power_bi_container"}
  embedConfig={{
    type: powerBiReportType, //Supported types: report, dashboard, tile, visual and qna
    id: powerBiReportId,
    accessToken: powerBiAccessToken,

    tokenType: models.TokenType.Embed,
    filters: [
      {
        $schema: powerBiReportEmbedUrl,
        target: {
          table: "", //table name
          column: "", //table column name for filter
        },

        operator: "eq", //eq, in etc
        values: [], //array of values eg. [493]
        requireSingleSelection: true,
      },
    ],

    settings: {
      panes: {
        filters: {
          expanded: false,
          visible: false,
        },
      },
      background: models.BackgroundType.Transparent,
      layoutType: models.LayoutType.Custom,
      customLayout: {
        displayOption: models.DisplayOption.ActualSize,
      },
    },
  }}
/>;
</div>
);
}