Article

Power BI Recipe: Passing Multiple Parameters and Implementing Row Level Security with Embedded Reports

When working with embedded reports, passing parameters can sometimes be a bit tricky, especially when dealing with multiple parameters. Recently, I stumbled upon an insightful video by Adam from “Guy in a Cube,” which you can watch here . While the video does an excellent job explaining how to pass a single parameter, it doesn’t fully cover the complexities involved with multiple parameters.

After some trial and error, I found a solution to handle multiple parameters effectively. Here’s a step-by-step guide that should help you navigate this challenge:

Step-by-Step Guide

Step 1: Create a Text Parameter First, create a text parameter. You can give it a default current value by joining both parameters with a comma.

Step 2: Split the Parameters Using M Code Next, write an M code to split these parameters into two separate parameters.

Step 3: Use the Resulting Variables Use the resulting variables as your parameters in your direct query.

Step 4: Create a New Table Create a new table with one column containing all merged multiple parameters. Bind that column with the main parameter (param) you created. Note that you need to apply Row-Level Security (RLS) to this column.

Step 5: Include Merged Parameters in C# Code Include the merged parameters in your C# code.

Follow the Video Steps After completing the above steps, follow the remaining steps in Adam’s video.

Community Insights

Once I posted this blog to the Power BI community, one super user asked me this question:

“The effective identity that you have passed from the C# code can filter the import mode (parameters) table because of RLS, but how will it change the M Query parameter value? It will remain the same unless some report user selects the value from a slicer or any visual?”

Solution: Microsoft Chiclet Slicer You can download the Chiclet Slicer from the import visuals.

Use it as a slicer instead of the traditional slicer. In the General settings of the Chiclet Slicer, change it to “Force Selection” and untick multiple selections.

This will automatically select the value from the column and pass the parameter to the parameters.

Additional Tips

There are a few additional steps that weren’t covered in the video but are crucial for a smooth implementation:

  1. Client ID and Secret: Make sure to enter the client ID and secret on the C# secrets page before debugging.

  2. New Playground Interface: The video uses the old playground interface. In the new playground, you need to click on the Developer Sandbox page and select “Use my embedded token.”

I hope this guide helps you in passing multiple parameters to your embedded reports efficiently!

Conclusion 

Successfully passing multiple parameters to embedded reports can significantly enhance the flexibility and usability of your data presentations. By following the steps outlined above—creating a text parameter, splitting parameters using M code, utilizing resulting variables, creating a new table with merged parameters, and including these in your C# code—you can effectively manage multiple parameters in your embedded reports.

Additionally, remember to implement crucial steps like entering the client ID and secret and adapting to the new playground interface for a smooth experience. These tips should help you navigate the complexities of embedding reports with multiple parameters, allowing for more dynamic and interactive data visualizations.

By leveraging tools like the Microsoft Chiclet Slicer, you can ensure that parameter values are dynamically selected and passed, further enhancing the interactivity and usability of your reports. Happy reporting!

Get in Touch and Let's Connect

We would love to hear about your idea and work with you to bring it to life.