Forum Discussion

jjustjjo's avatar
jjustjjo
Icon for Helper II rankHelper II
5 months ago
Solved

Conditional Text in a TT page based on segment hovered in stacked column chart

I have a stacked column chart wih three measures on the Y axis:

I have as tooltip page defined, but want to add conditional text based on which segement I'm hovering over (Late, On Time, Completed).  How do I do this?  I've tried

  • selectedmeasurename() returned the name of the measure I tried
  • isblank([% Late]) thinking maybe it would be if it weren't hovered over but that doesn't work

The goal is to be able to say " were <Late|On Time|Completed> based on the segment hovered.  I'm also planning on hiding a table of info if Late is not hovered.
Can this be done?  Thanks in advance!

 

  • Hi jjustjjo 

    When you use separate measures in a visual, the tooltip page can’t tell which one is being hovered. Measures don’t have row context, so there’s no filter value to pass through. A common workaround is to create a disconnected table with a column of measure names, then reference that column in a conditional measure.

     

    Please see the attached pbix.

2 Replies

  • Hi jjustjjo ,

    I’ve found a way to determine the column segment. It’s more complicated than I’d thought, and I hope it works in your report too.

     

    The solution is based on a calculation group:

    1. Define a new calculation group named "Column Segments"
    2. Name the column of the calculation group something like "Selected Measure"
    3. Define a calculation item for every of your measures defining the segments. Every items should look like the following one:
      A Name for the Segment = IF(SELECTEDMEASURENAME() = "Chart Dummy",
          [your measure for the segment],
          SELECTEDMEASURE()
      )
      (The IF clause ensures that the only a measure called "Chart Dummy" will be replaced by your segment measures)
    4. Define the Chart Dummy measure:
      Chart Dummy = 0
      (The exakt definition is irrelevant, because the measure is replaced by the measures defined in the calculation items)
    5. Add Chart Dummy as the only value to the y-axis of your chart
    6. Add Column Segments[Selected Measure] as a legend to your chart
    7. Now it should be possible to use the following measure to detect the selected segment at your tooltip page
      Tooltip Measure Detector = SELECTEDVALUE('Column Segments'[Selected Measure], "No selection")
    8. Here is an impression from my demo:

       

    Hope that works for you too.

  • Hi jjustjjo 

    When you use separate measures in a visual, the tooltip page can’t tell which one is being hovered. Measures don’t have row context, so there’s no filter value to pass through. A common workaround is to create a disconnected table with a column of measure names, then reference that column in a conditional measure.

     

    Please see the attached pbix.