Forum Discussion
Dynamic Text for a Visual
Hello All,
I have a requirement where I have to have a dynamic heading for a visual. The visual is a Pie chart where, the values are Department by Sales.
I want the visual to represent something like this " The best department is ' <Department name>' follwed by '<Dept name>'
Can someone please let me know how to achieve this.
Regards
3 Replies
- AdamboerResponsive Resident
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.
- AjayBI55Frequent Visitor
Hello Kish1999
If you want to show best department as dynamic title for that you need to create one department slicer.
You can use below mentioned measure you can get dynamic title.
DynamicTitleCategory = var _Category = SELECTEDVALUE(Data[Product Category])var _finaltitle = "The best Category is " & _CategoryreturnIF(ISTEXT(_Category), _finaltitle, "Total Sales by Category")Did i answer you question❓ Please mark my post📮 as solution.ThanksAjay