Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jsola
Frequent Visitor

Embedded - Open Same Report Simultaneously with Different Filters in Dataset

Hello everyone,

I am embedding a Power BI report in a web application using the Power BI REST API and JavaScript SDK. My goal is to open multiple instances of the same report at the same time, each with different filters applied at the dataset level.

How It Works:

  • The C# code authenticates with Azure AD, retrieves an access token, and generates an embed token for the report.
  • It updates dataset parameters  before generating the embed token.
  • The HTML/JS file then embeds the report using the Power BI JavaScript SDK, ensuring each instance has a unique session ID.

The Problem:

Even though I apply different filters to the dataset before opening the report, when multiple reports are opened simultaneously, they share the same filter state. This means that applying a filter in one instance affects the others.

Questions:

  1. What am I doing wrong?
  2. How can I ensure that each report instance keeps its own dataset filters without interfering with the others?
  3. Is there a way to generate independent dataset snapshots per session?
  4. Would using separate datasets or duplicate reports be the only workaround?

This is my embed code: 

 

<!DOCTYPE html>
<html lang='es'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Fabric SandBox</title>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"
            integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
            crossorigin="anonymous"></script>
    <script src="powerbi.js"></script>
</head>
<body>
    <h2>Fabric Sandbox</h2>
    <div id='{{CONTAINER_ID}}' style='width:100%;height:800px;'></div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            if (typeof powerbi === 'undefined' || !window.powerbi) {
                console.error(' Power BI Client SDK no se cargó correctamente.');
                return;
            }
            var models = window['powerbi-client'].models;

            var embedConfig = {
                type: 'report',
                id: '{{REPORT_ID}}',
                embedUrl: 'https://app.powerbi.com/reportEmbed?reportId={{REPORT_ID}}&groupId={{WORKSPACE_ID}}',
                accessToken: '{{EMBED_TOKEN}}',
                tokenType: models.TokenType.Embed,
                settings: {
                    filterPaneEnabled: false,
                    navContentPaneEnabled: false
                }
            };


            // Agrega el parámetro a la URL de embed
            var embedUrl = 'https://app.powerbi.com/reportEmbed?reportId={{REPORT_ID}}&groupId={{WORKSPACE_ID}}&rs:embedsessionid={{UNIQUESESSIONID}}';
            embedConfig.embedUrl = embedUrl;


            if (report) {
                report.destroy().then(function () {
                    
                    var oldContainer = document.getElementById('{{CONTAINER_ID}}');
                    oldContainer.parentNode.removeChild(oldContainer);
                    
                    var newContainer = document.createElement('div');
                    newContainer.id = '{{CONTAINER_ID}}';
                    newContainer.style.width = '100%';
                    newContainer.style.height = '800px';
                    document.body.appendChild(newContainer);

                    
                    embedConfig.embedUrl = 'https://app.powerbi.com/reportEmbed?reportId={{REPORT_ID}}&groupId={{WORKSPACE_ID}}&cb=' + new Date().getTime();
                    
                    report = powerbi.embed(newContainer, embedConfig);
                });
            }

            var reportContainer = document.getElementById('{{CONTAINER_ID}}');
            var powerbiService = powerbi
            powerbiService.reset(reportContainer);
            var report = powerbiService.embed(reportContainer, embedConfig);

        });
    </script>
</body>
</html>

 

Any suggestions would be greatly appreciated! 🚀

 

Thanks 🤗

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Jsola,

Thanks for reaching out to the Microsoft fabric community forum.

 

I understand that you're trying to open multiple instances of the same Power BI report with different dataset-level filters, but the filters are being shared across instances. This happens because modifying dataset parameters before generating an embed token applies changes at the dataset level, which affects all report instances. You can use Report-Level Filters instead of Dataset Parameters as rather than modifying the dataset, apply report-level filters dynamically using the Power BI JavaScript SDK. 

 

I would also take a moment to thank @Deku, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Jsola,

Thanks for reaching out to the Microsoft fabric community forum.

 

I understand that you're trying to open multiple instances of the same Power BI report with different dataset-level filters, but the filters are being shared across instances. This happens because modifying dataset parameters before generating an embed token applies changes at the dataset level, which affects all report instances. You can use Report-Level Filters instead of Dataset Parameters as rather than modifying the dataset, apply report-level filters dynamically using the Power BI JavaScript SDK. 

 

I would also take a moment to thank @Deku, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

Hi,

Thanks for your response, @Deku  and @Anonymous 

I’m considering applying RLS (Row-Level Security) in C# before generating the embed token to filter the data. I believe filtering using the Power BI JavaScript SDK is somewhat insecure, as an advanced user could modify the code in the browser and gain access to restricted data.

 

I’ll give this option a try and let you know how it goes.

 

Many thanks, and have a great weekend!

 
Deku
Super User
Super User

This sounds alot like the power bi load test tool. I would look at this repo


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.