Forum Discussion
Dynamic Text for a Visual
To achieve a dynamic heading for your Pie chart visual, you can follow these steps:
Create a new measure with the following formula:
Top 2 Departments =
VAR DepartmentSales =
TOPN(2,
SUMMARIZE('Table', 'Table'[Department], "Sales", SUM('Table'[Sales])),
[Sales], DESC)
VAR Department1 = DepartmentSales[Department]
VAR Department2 = DepartmentSales[Department.1]
RETURN "The best department is '" & Department1 & "' followed by '" & Department2 & "'"Note that you will need to replace 'Table' with the name of your table and 'Sales' with the name of your sales column.
Add the Pie chart visual to your report and add the Department column to the Legend field and the Sales column to the Values field.
In the Visualizations pane, expand the Title card and enable the Title toggle.
Click on the fx button next to the Title text box and enter the name of the measure you created in step 1.
Now, whenever you refresh your report data, the Pie chart visual will display a dynamic heading based on the top 2 departments by sales.