Forum Discussion

Markzolotoy's avatar
Markzolotoy
Impactful Individual
2 years ago

Paginated report subreports - conditional execution

I have a master report with a few subreports. I want to run a subreport based on a parameter from the master report. Any idea how to do it?

 

Thanks

3 Replies

  • Markzolotoy's avatar
    Markzolotoy
    Impactful Individual

    What I actually meant is that in case not to run it the subreport is not pulling data and it's not visible. My data source is a PowerBI dataset.

  • v-zhangti's avatar
    v-zhangti
    Community Support

    Hi, Markzolotoy 

     

    To conditionally execute a subreport based on a parameter from the master report in a paginated report, you can use a visibility expression. Here's how:

    • 1. Open the subreport in design view.
    • 2. Select the subreport's body or container.
    • 3. In the Properties pane, go to the Visibility section.
    • 4. Select "Show or hide based on an expression".
    • 5. Enter an expression that evaluates to true or false based on the parameter value from the master report. For example, if your parameter is called "Subreport1Visible" and its value is "True", you could use the following expression: =IIF(Parameters!Subreport1Visible.Value = "True", False, True)

    This expression will hide the subreport if the parameter value is "True", and show it if the parameter value is anything else.

     

    Note that if the subreport is not pulling data and not visible when the parameter value is "False", you may need to adjust the subreport's query or data source to handle this case. You could also consider using a default value for the parameter that ensures the subreport always runs, but only displays data when the parameter value is set appropriately.

    Subreports in Power BI paginated reports - Power BI | Microsoft Learn

    Add a subreport and parameters to a Power BI paginated report - Power BI | Microsoft Learn

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Markzolotoy's avatar
    Markzolotoy
    Impactful Individual

    v-zhangti If I just hide subreport it still runs. Even if I run its query conditionally based on a parameter some processing still takes place. That is confusing to users. Their expectation is that is they dont select reports to run nothing at all should be happening on the screen.