Forum Discussion

Oodi's avatar
Oodi
Frequent Visitor
2 years ago

Using Measure Name as Dynamic Title

Hello,

I'm creating a dynamic tooltip which displays dynamic title based on selection in a given time visual.

The tooltip should display the selected measure title

for column names below works fine

Title =
IF(ISFILTERED(Tickets[Topic], Tickets[Topic] = SELECTEDVALUE(Tickets[Topic])

 but what ways are there to display measure titles in such way?

I have tried  

Measure Title =
IF(HASONEVALUE('MeasuresTable'[Measures]),
VALUES('MeasuresTable'[Measures]),
" ")

but this requires at least one measure to be filtered in order to work. Other way just shows blank.

Is there any alternatives?

5 Replies

  • Oodi's avatar
    Oodi
    Frequent Visitor

    lbendlin, xifeng_L 
    Xifeng your solution works in Matrix. When tying to apply it in a line chart with multiple measures in y-axis and Date in x-axis the same continues. When filtering one measure (one line) it works but when all lines are visible it doesn't. 
    Also tried below but same result.

     

    VAR _Selected =
    IF(SELECTEDMEASURENAME() = "Tickets", SELECTEDMEASURE(),
    BLANK())
    
    VAR _Selected2 =
    IF(SELECTEDMEASURENAME() = "Tickets", "Tickets",
    BLANK())

     



    Any ideas how to make it work with field parameters? Tried below:

     

    Tickets = {
        ("Tickets", NAMEOF('DimMeasures'[Tickets]), 0),
        ("Tickets Cancelled", NAMEOF('DimMeasures'[Tickets cancelled]), 1),
        ("Tickets not on time", NAMEOF('DimMeasures'[Tickets not on time]), 2),
        ("Tickets on time", NAMEOF('DimMeasures'[Tickets on time]), 3)
    }

     

    However when choosing it with 

     

    SELECTEDVALUE(Tickets[Parameter])

     

     Power BI gives the error:

     

    Couldn't load the data for this visual
    MdxScript(Model) (303, 1) Calculation error in measure 'DimMeasures'[Measure Title_]: Column [Parameter] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.

     

     

    • lbendlin's avatar
      lbendlin
      Super User

      that is to be expected.  All of the "SELECTED"  functions only work if there is exactly a single value present.

  • Oodi's avatar
    Oodi
    Frequent Visitor

    Keeping the topic open if anyone has insights:

    To recap trying to display measure name in a dynamic title with custom report page tooltip in a same way Power Bi displays measure names in a default tooltip but only displaying one measure title (the one that you are hovering on) at a time instead of all like in the below examples.

    Example with Measures in Values.

    Example with Parameters in Values:


    Tickets = {
        ("Tickets", NAMEOF('DimMeasures'[Tickets]), 0),
        ("Cancelled Tickets", NAMEOF('DimMeasures'[Cancelled Tickets]), 1),
        ("Delayed Tickets", NAMEOF('DimMeasures'[Delayed Tickets]), 2),
        ("On time Tickets", NAMEOF('DimMeasures'[On time Tickets]), 3)
    }