Forum Discussion

Aartibhilare's avatar
Aartibhilare
Helper III
1 year ago
Solved

Looping for multivalued in power Bi report builder

Hi everyone, Hope you're all doing well. I’m working on a Power BI report builder and I have a query regarding handling multi-value selection. In my report, we have a slicer to select the Company N...
  • v-veshwara-msft's avatar
    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.