Forum Discussion

dgnm82's avatar
dgnm82
New Member
2 years ago
Solved

Power BI Report Builder - Header Image changes based upon value in body

Hi all - 

 

Worked with PowerBI for a long time, but trying out a Paginated report (Report Builder) for the first time. So forgive me if there's an easy answer.

 

Is there a way to hide/show images (logos) in the header based upon data in the body? This would need to be on a per page basis. 

 

For instance, data relating to company 1 is on pages 1 and 2 of the report. The header logo on those two pages should be for company 1. Data relating to company 2 is on pages 3-5. The corresponding logo should be visible in the header for company 2 on those pages.

 

So on and so forth.

 

Is something like this possible?

  • dgnm82's avatar
    dgnm82
    2 years ago

    Turns out it was a lot simpler than I previously thought. I was able to create a formula on the image in the page header and suppress using ReportItems. My expression to hide the image was:

     

    =ReportItems!COMPANY.Value <> 61

     

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi dgnm82 ,

    You can add an Image Item to the Header: Place an image item in the header of your report.Something like this

     

    You will need to write an expression for the image value that evaluates the current page's data and returns the appropriate logo's URL. This can be done using the `Globals!PageNumber` to determine the page and then looking up the corresponding logo URL from your dataset.

    sql =Switch( Fields!CompanyName.Value = "Company 1", "http://url_to_company_1_logo", Fields!CompanyName.Value = "Company 2", "http://url_to_company_2_logo", True, "http://url_to_default_logo" )Best Regards

    Best Regards

    Xianda Tang

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

     

    • dgnm82's avatar
      dgnm82
      New Member

      Thank you Xianda! I'll test it out this morning.

    • dgnm82's avatar
      dgnm82
      New Member

      Reading through your suggestion more closely, you don't actually reference the 'Globals!PageNumber' in your formula. Could you clarify how to create a formula that uses the page number to determine a field value on that page?

    • dgnm82's avatar
      dgnm82
      New Member

      Turns out it was a lot simpler than I previously thought. I was able to create a formula on the image in the page header and suppress using ReportItems. My expression to hide the image was:

       

      =ReportItems!COMPANY.Value <> 61