Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

278
Vistas
Filters in Power BI embed report

I developed a few months ago a NodeJS API to get embed reports from Power BI (using a tenant). I consume this API from an Angular app. Now I want to get the report filtered, and I don't know if this is possible with my actual code.

I used the PowerBI rest API to get the embed report. Reading the docs of microsoft, I see lots of docs like this one, where says that I should create an object with the filters that I want. This is not a problem, but I don't know if this is compatible with mi actual Node API or I should develop a new solution.

My API follows the sample provided by Microsoft, and the code is:

async function getEmbedParamsForSingleReport(
  workspaceId,
  reportId,
  additionalDatasetId
) {
  const reportInGroupApi = `https://api.powerbi.com/v1.0/myorg/groups/${workspaceId}/reports/${reportId}`;
  const headers = await getRequestHeader();
  // Get report info by calling the PowerBI REST API

  const result = await axios.get(reportInGroupApi, { headers });

  if (result.status !== 200) {
    throw result;
  }

  // Convert result in json to retrieve values
  const resultJson = result.data;

  // Add report data for embedding
  const reportDetails = new PowerBiReportDetails(
    resultJson.id,
    resultJson.name,
    resultJson.embedUrl
  );

  const reportEmbedConfig = new EmbedConfig();

  // Create mapping for report and Embed URL
  reportEmbedConfig.reportsDetail = [reportDetails];

  // Create list of datasets
  let datasetIds = [resultJson.datasetId];

  // Append additional dataset to the list to achieve dynamic binding later
  if (additionalDatasetId) {
    datasetIds.push(additionalDatasetId);
  }

  // Get Embed token multiple resources
  reportEmbedConfig.embedToken =
    await getEmbedTokenForSingleReportSingleWorkspace(
      reportId,
      datasetIds,
      workspaceId
    );
  return reportEmbedConfig;
}

With this I obtain the embed report and send back to my app. Is this solution compatible with filters?

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Finally, I came out with a solution. In mi Angular app, I use the library powerbi-client-angular. That allows me to define some configuration in the embed report:

  basicFilter: models.IBasicFilter = {
    $schema: 'http://powerbi.com/product/schema#basic',
    target: {
      table: 'items',
      column: 'id',
    },
    operator: 'In',
    values: [1,2,3],
    filterType: models.FilterType.Basic,
    requireSingleSelection: true,
    displaySettings: {
      /** Hiding filter pane */
      isLockedInViewMode: true,
      isHiddenInViewMode: true,
    },
  };

  reportConfig: IReportEmbedConfiguration = {
    type: 'report',
    id: cuantitativeReportID,
    embedUrl: undefined,
    tokenType: models.TokenType.Embed,
    filters: [this.basicFilter],
    accessToken: undefined,
    settings: undefined,
  };

With this, I can avoid passing information to the NodeJS API

about 4 years ago · Juan Pablo Isaza Denunciar

0

Yes, It will work fine with this solution. Please find the relevant code below:

  1. Create a filter object:
const filter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Geo",
column: "Region"
},
operator: "In",
values: ["West", "Central"]
};
  1. Add the filter to the report's filters:
await report.updateFilters(models.FiltersOperations.Add, [filter]);

You can refer sample NodeJS application to get embed reports from Power BI. Please find the the reference here: https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/NodeJS

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda