Walkthrough: Build Dynamic Captions
In this dynamic custom member captions example, we want to inject the sales team into the query from the parameter. We also want the custom member caption to change in accordance with the slicer selection, so that the caption displays the selection, rather than the name of the custom member. We start by building a text parameter, which is then used to build a list based on a Switch expression. The list is then aggregated as a custom member, and dynamic custom member captions are configured based on the text parameter.
Step 1
Build a global text parameter. The Value fields should contain the text that you want to display in the visual; in this case, this is the names of the sales teams. Save the parameter.
Step 2
Using the parameter configured in Step 1, build a Switch statement in List.
When configuring the switch block, select the parameter build in Step 1. Then add a standard list block each branch, and add the relevant list of sales teams to each list block. Save the custom list.
Step 3
In Formula, build a custom member by aggregating the switch list build in Step 2. Insert a Standard List block into the aggregate function, and add the switch function to the list block.
Step 4
Open the Advanced Script editor from the Dynamic Caption window; from the Global Parameter panel, find and select the text parameter build in Step 1, and place it within inverted commas " ". Click Apply and save the custom member.
Step 5
Open the custom member in Discover; the custom member caption will be injected into the visual when a slicer selection is made.