Forum Discussion

soliverc's avatar
soliverc
Frequent Visitor
2 years ago

Dynamic DAX title not updating with selected value.

I want the title of a slicer to change depending on if something is selected or not. 

 

For example, a slicer with a vertical list of countries. 

 

If there is not country selected, the Slicer title is just: "Country"

If there is a country selected, the Slicer title changes to "Country*" with an asterisk.

 

I have put this piece of code into the Slicer title field (using the fx button).

 

_countrySlicerTitle = 
VAR SelectedCountry = SELECTEDVALUE(data[Country])
RETURN
    IF(ISBLANK(SelectedCountry), "Country", "Country *")

 

However, when I select a country in the slicer, nothing happens to the title. It stays on "Country".

 

If I put the Dax title into a separate card, it updates when something is selected. 

 

What am I doing wrong? Or is this a bug?

 

 

3 Replies

  • soliverc , seems like you are creating a calculated column. A calculated column can not use selected values. Only measure can use

    • soliverc's avatar
      soliverc
      Frequent Visitor
      It's a measure. I clicked "New Measure" not "New Column"
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi amitchandak ,thanks for the quick reply, I'll add further.

    Hi soliverc ,

    Regarding your question, I conducted a test and found it to be unattainable.Because in the chart title conditional formatting, the 'SELECTEDVALUE' can only return when it's been filtered but not been highlighted.I created a second slicer for the title to take effect.

    You may be able to achieve your needs indirectly by combining card visualization objects.

    Measure = IF(ISFILTERED('Table'[Country]) = FALSE(),"Country","Country*")

     


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