Dynamic Card Title Implementation Method
Scenario One
The card is set to display data for the current day (or yesterday) by default, and you want the card title to include the current date, which changes dynamically every day.
Implementation Method
-
In the card edit page, filter the date range to "Today", or use other methods to make the card only count data for the current day.
-
Edit the card title, and manually write a time macro in the appropriate position in the card title, such as {{{today}}}.
-
Save the card and return to the page. You can see that the card title already includes the current date.
Scenario Two
Page filter linkage with cards, hoping that the card title remains consistent with the filter options, and the card title changes when switching filter items.
Implementation Principle
Use global parameters. For specific introduction, please refer to Global Parameters.
Implementation Method: Using Date Filter as an Example
-
Create a new calculated field "Title", and use the concat function to combine the field that references the parameter from step one with text to form a title according to your needs, text type. Note: For direct connection datasets, you need to use the corresponding database functions. In some databases, date type fields cannot be directly used as text for concatenation, so they need to be converted to text format first.
-
In the card settings on the right side, cancel the display of the title.
-
Click the summary indicator in the top-left corner of the card, set: indicator name as empty (delete the original name or replace with 1 space), indicator name position select "Below" or "Right", select field "Title", summary method as "Maximum" or "Minimum", data format doesn't need to be modified. Click "OK" to save, then the title displays the default value of the global parameter. Note: Summary indicators currently don't support setting font formats.
-
To achieve synchronized filtering of data based on the filter, you need to additionally create a judgment field for filtering out data that meets the filter requirements, and drag this field into the filter bar, selecting True.
-
Save the card and return to the page. Create a new date filter, then associate it with the card, selecting the time-type global parameter used in the card in the association parameters. Note: "Allow Clear (Select All Dates)" is recommended not to be checked, because in the case of filter linkage with global parameters, an empty filter doesn't represent select all or no linkage, but will filter data according to the initial default value of the global parameter (default value cannot be empty). The default value set in the filter cannot replace the initial default value of the global parameter.
-
Save the filter. Switch the filter, and the card effect is as follows.
Others
Scenario two method can not only be used for dynamic date display, but also applies to dynamic display of dimension fields (aggregation levels) and numerical fields (indicators), with the same implementation method.
For related usage, please refer to Using Global Parameters to Create Dynamic Dimension Reports, Using Global Parameters to Implement Dynamic Indicator Display. For combined usage effects, please refer to the figure below.
