Forum Discussion

Bernice's avatar
Bernice
New Member
25 days ago

Dynamic Headers with Multi-value Parameter

I have a report based on Departments. I need to be able to change the specific department when doing a multi-value parameter, i.e. select all option.  Want to display the specific department in the header for the data displayed.  It works fine if only selecting an individual department.  When select all is chosen, it only displays the first department for all pages.  Any assistance would be appreciated.

12 Replies

  • Hi Bernice​, 

    Can you share a sample file or include screenshots of what you are after? 

    What visual are you using? Is this a Power BI report or a paginated report? 

    Generally, a table visual can only have one value in the header row, it can't support multiple values there, and the default summarization is first. 

    Some more details about what exactly you're trying to do would help. 

    • Bernice's avatar
      Bernice
      New Member

      Using Paginated report

      Using a textbox in the header to display the Department name associated with the budget data that is in the report. 

      There are 14 departments that I'm trying to select all departments and have it print the departments in one lump batch, with each department having 1-3 pages per department of budget data. 

       Is there a recommendation of how to do this, other than selecting individual departments one by one from the parameter list and printing it off?

      • tayloramy's avatar
        tayloramy
        Icon for Super User rankSuper User

        Hi Bernice​,

        you would need to build the paginated report to be able to handle multiple values for department. 

        One way to do this is to add department in the row groups at the bottom and then the report will generate a new section for each new department.  

    • Bernice's avatar
      Bernice
      New Member

      Paginated report

      There are 14 departments that are 1-3 pages in length of budget data associated with each department.  The user would like to be able to do a select all on the parameter values to select all departments, display/print out the budget data for each department.

      Any suggestions would be appreciated.

  • If the reports are run individually, the department name is correctly displayed in the header and the footer and everything is good.  It is just when trying to run under the select all option for multi-parameters, that it doesn't work.

     

  • jubinsoni's avatar
    jubinsoni
    Icon for Memorable Member rankMemorable Member

    Hi Bernice​,

    To add the missing piece to the grouping suggestion above: the reason the header always shows the first department is that a page header cannot see the current group directly, so =Fields!Department.Value (or First()) is evaluated once for the whole dataset. The standard trick is to put the department in a textbox inside the group and have the page header read that textbox through ReportItems, which is evaluated per page.

    1. Group the tablix by Department with a page break

    Row Groups > Add Group > Parent Group > Group by: [Department]
      -> tick "Add group header"
    Group Properties > Page Breaks
      -> Between each instance of a group = checked
      -> (optional) Page numbering: Reset page number = checked
    Advanced mode (Row Groups dropdown > Advanced) > static row of the
    group header > RepeatOnNewPage = True, KeepWithGroup = After

    2. Put the department in the group header in a textbox named, for example, txtDept with =Fields!Department.Value. You can hide it if you don't want it in the body (Hidden = True still works for ReportItems as long as it is on the page).

    3. Page header textbox:

    ="Department: " & First(ReportItems!txtDept.Value)

    4. Optional extras: set the group's PageName to =Fields!Department.Value, so when you export to Excel each department lands on its own sheet, and use Globals!PageNumber / Globals!TotalPages in the footer with the reset option to get "Page 1 of 3" per department.

    Also make sure the dataset filters on the parameter with IN (or the dataset query uses WHERE Department IN (@Department)), so Select All returns all 14 departments in one run.

    So my overall approach would be:

    Dataset: WHERE Department IN (@Department)
    -> Group tablix by Department, page break between instances
    -> txtDept in the repeating group header
    -> Page header: First(ReportItems!txtDept.Value)
    -> PageName + reset page numbers per department

    AI-assisted drafting: AI was used to help structure and phrase this response. I reviewed and validated the technical content before posting.

    • Bernice's avatar
      Bernice
      New Member

      Hi Jubinsoni,

      I didn't see your suggestion until just now.  I will try this out tomorrow. I appreciate the step by step instructions, as I'm still learning. (I did already have the WHERE department IN (@Department) in the dataset, so it was pulling in the correct data, with a Select All Option, just not showing the correct department header.

      I will update after I try these steps.

      Thank you.

       

      • v-aatheeque's avatar
        v-aatheeque
        Icon for Community Support rankCommunity Support

        Hi Bernice​ 

        Following up to confirm if the earlier responses addressed your query. If not, please share your questions and we’ll assist further.