Forum Discussion
Looping for multivalued in power Bi report builder
- 1 year ago
Hi Aartibhilare ,
Thanks for reaching out to Microsoft Fabric Forum Community,
To meet your requirements ,you can use the following approach:
You can create Multi-value parameters, Create Conditional Report Views and Control Visibility Dynamically.
Step 1: Create a Multi-Value Parameter
In your Power BI report, create a parameter (e.g., CompanyParameter) and check Allow multiple values. This will be linked to your slicer for selecting the company names.Step 2: Add a Dataset to Fetch the Selected Companies
- Create a dataset (e.g., SelectedCompanies) to capture the selected values of the parameter.
- Use an expression to convert the selected companies into a comma-separated list for visibility logic.
Example SQL :
SELECT CompanyName
FROM Companies
WHERE CompanyName IN (@CompanyParameter)
Step 3: Create Conditional Report Views- SingleView: For individual company selections.
- MultiView: For multiple company selections.
Step 4: Control Visibility Dynamically
- Set the visibility of the different report views based on the parameter.
For SingleView:
=IIF(Parameters!CompanyParameter.Count > 1, True, False)
For MultiView:
=IIF(Parameters!CompanyParameter.Count = 1, True, False)
Run the report and test the slicer selection,
If you need further assistance please reach out.
Hope this works for you,
Please consider giving a kudos and accept as solution to help others find it.Thank you.
Hi Aartibhilare ,
Thanks for reaching out to Microsoft Fabric Forum Community,
To meet your requirements ,you can use the following approach:
You can create Multi-value parameters, Create Conditional Report Views and Control Visibility Dynamically.
Step 1: Create a Multi-Value Parameter
In your Power BI report, create a parameter (e.g., CompanyParameter) and check Allow multiple values. This will be linked to your slicer for selecting the company names.
Step 2: Add a Dataset to Fetch the Selected Companies
- Create a dataset (e.g., SelectedCompanies) to capture the selected values of the parameter.
- Use an expression to convert the selected companies into a comma-separated list for visibility logic.
Example SQL :
SELECT CompanyName
FROM Companies
WHERE CompanyName IN (@CompanyParameter)
Step 3: Create Conditional Report Views
- SingleView: For individual company selections.
- MultiView: For multiple company selections.
Step 4: Control Visibility Dynamically
- Set the visibility of the different report views based on the parameter.
For SingleView:
=IIF(Parameters!CompanyParameter.Count > 1, True, False)
For MultiView:
=IIF(Parameters!CompanyParameter.Count = 1, True, False)
Run the report and test the slicer selection,
If you need further assistance please reach out.
Hope this works for you,
Please consider giving a kudos and accept as solution to help others find it.
Thank you.
is there any document of llink which can i refer to for this?
- v-veshwara-msft1 year agoCommunity Support
Hi Aartibhilare ,
Thanks for the reply
Here are the supporting document links,
Report Parameters:
https://learn.microsoft.com/en-us/power-bi/paginated-reports/parameters/report-parameters-concepts-report-builder
https://learn.microsoft.com/en-us/power-bi/paginated-reports/parameters/add-change-delete-report-parameter-report-builder
Datasets, Conditional Report Views, Visibility:
https://learn.microsoft.com/en-us/power-bi/paginated-reports/report-design/add-dataset-filters-data-region-filters-and-group-filters
https://learn.microsoft.com/en-us/power-bi/paginated-reports/report-builder/connect-snowflake-databricks-power-query-online
Hope these help.- Aartibhilare1 year agoHelper III
I have created parameters n all how i can handle below things?
Step 3: Create Conditional Report Views
- SingleView: For individual company selections.
- MultiView: For multiple company selections.
Step 4: Control Visibility Dynamically
- Set the visibility of the different report views based on the parameter.
For SingleView:
=IIF(Parameters!CompanyParameter.Count > 1, True, False)
For MultiView:
=IIF(Parameters!CompanyParameter.Count = 1, True, False)
- v-veshwara-msft1 year agoCommunity Support
Step 3: Create Conditional Report Views
Add Two Rectangles:
Go to the Design View of your report.
Drag two rectangles onto the canvas:
You can name one as SingleviewRectangle for single-company selection.
Name the other as MultiviewRectangle for multiple-company selection.
Place Data Controls:
Inside SingleviewRectangle, add your choice of vsuals like table or matrix or chart to display detailed data for a single company.
Repeat the same for MultiviewRectangle adding visuals for multiple companies in the rectangle.
Bind the Rectangles to Datasets:
For the single-company view, bind the controls to your SingleCompanyDataset.
To do this go to the properties of the visual in the rectangle and under dataset name, choose the required dataset.For the multi-company view, bind the controls to your MultiCompanyDataset.
Repeat same process as above.
Step 4: Control Visibility DynamicallyGo to the properties of the Rectangle ,
Go to the Visibility tab.
Under Show or Hide Based on Expression, add this expression:
=IIF(Parameters!YourParameter.Count > 1, True, False)
This hides the single-company view when multiple companies are selected.
Repeat the same for MultiviewRectangle and add this expression
=IIF(Parameters!YourParameter.Count = 1, True, False)
Test the Visibility:
Run the report, toggle between single and multiple company selections, and ensure the correct views are displayed.