Forum Discussion

pradeept's avatar
pradeept
Resolver I
5 years ago

Dynamic Label in Title

Hi,

 

Need help in dynamic labeling.

 

Scenario:  In one page i created 4 charts, with different dimensions(Top 3). I want to toggle between the metrics, across all the 4 charts. 

accordingly title label should change automatically.

 

What I did so far:  Created a table in Power BI for toggle purpose; Created a slicer with Metric name; and written the DAX query. Applied the calculated measure in all the charts; Results are as expected.

See the attached sample.

 

Issue:  Not able to change the Title of the charts as expected. 

When I click on the Sales Amount in the slicer, the chart label should be changed to  

chart1 : "Top 3 sates by Sales Amount"

chart2 : "Top 3 products by Sales Amount"

 

When I click on the Transactions in the slicer, the chart label the label should be changed to  

chart1 : "Top 3 sates by Transactions"

chart2 : "Top 3 products by Transactions"

 

Thanks in Advance.

 

7 Replies

  • PC2790's avatar
    PC2790
    Community Champion

    Consider using SELECTEDVALUE DAX to capture the selection in a measure and then use it in your title.

    Eg: In your case it would be something like:

    Title of Sales Chart: "Top 3 Sales by" & SELECTEDVALUE(<Slicer Selection>)  

    Title of Product Chart: "Top 3 Product by" & SELECTEDVALUE(<Slicer Selection>)  

     

    You can use these measure in the title of the corresponding charts as a formula as below:

    Based on field is your measure

     

    For more details, refer below:

    https://www.fourmoo.com/2017/08/01/power-bi-dynamically-changing-the-title-based-on-your-selection/

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    1. Create two Dax Measures for State and Product 

    • StateMeasure  = If( SELECTEDVALUE(Table[Category]) = "SalesAmount" , "Sales Amount", SELECTEDVALUE(Table[Category])) & " by State"
    • ProductMeasure  = If( SELECTEDVALUE(Table[Category]) = "SalesAmount" , "Sales Amount", SELECTEDVALUE(Table[Category])) & " by Product"

    2. Select the visual and go to format pane and enable Title and Click on "fx"  and follow as per below screenshot

     

  • pradeept  You can create 4 viz . 2 for Sales and 2 for transaction . Then create 2 bookmark then program it whenever you toggling it will fulfil your requirement . Add 2 button  Bingo

     

     

  • Hi all, 

    thanks for your quick responses.

    I tried these options already. With these approach,  i need to create 6 measures/dynamic labels (as i have 6 charts). that means for each chart one separate measure. but I am looking for one Dynamic measure only instead of 6.

     

    Expectation:

    Chart-1: 'Top 3' <Dimension1> by <Slicer_Measure>  

    Chart-2: 'Top 3' <Dimension2> by <Slicer_Measure>

    Chart-3: 'Top 3' <Dimension3> by <Slicer_Measure>

    ...

     

    Thanks in advance.

    • v-deddai1-msft's avatar
      v-deddai1-msft
      Community Support

      Hi pradeept ,

       

      You have to create 6 measure for dynamic titles. There is no approach to get dimensions you used in visuals by dax measure.

       

      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

       

      Best Regards,

      Dedmon Dai