Forum Discussion

wmendes17's avatar
wmendes17
New Member
2 years ago

Dynamic Tooltip using selectedmeasure

Hi guys,

I'm trying to use this measure in an HTML Content or Card visual as a tooltip, and depending on the measure and the result of a visual when hovering the mouse over the visual, I would like the tooltip to bring the dynamic result based on the result and calculation of each visual, However, when performing the calculation below it gives me a blank, would anyone know any other way to do it?

 

Tooltip_Message =
VAR SelectedMeasure = SELECTEDMEASURE()

RETURN
    SWITCH (
        TRUE (),
        SelectedMeasure = [Tr_Auto_Enrolment],
            VAR Result = [Tr_Auto_Enrolment]
            RETURN
                SWITCH (
                    TRUE (),
                    Result = [Check_Mark], "TR_ENROLMENTE CHECK " & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    Result = [Exclamation_Mark], "TR_ENROLMENTE EXC " & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    Result = [Slash_Mark], "TR_ENROLMENTE SLASH " & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    ""
                ),
        SelectedMeasure = [Tr_Onboarding N User],
            VAR Result = [Tr_Onboarding N User]
            RETURN
                SWITCH (
                    TRUE (),
                    Result = [Check_Mark], "Onboarding Check " & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    Result = [Exclamation_Mark], "Onboarding Exc " & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    Result = [Slash_Mark], "Onboarding Slash " & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    ""
                ),
        SelectedMeasure = [Tr_Scalable Mods],
            VAR Result = [Tr_Scalable Mods]
            RETURN
                SWITCH (
                    TRUE (),
                    Result = [Check_Mark], "Scalable Check" & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    Result = [Exclamation_Mark], "Scalable Exc " & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    Result = [Slash_Mark], "Scalable Slash " & "<span style = 'font-weight: bold'>" & FORMAT([%Login], "0%") & "</span>" & " of A&P spend",
                    ""
                ),
        ""
    )
 
the 3 measures that they are based on [Tr_Auto_Enrolment], [Tr_Onboarding N User], [Tr_Scalable Mods] follow the same calculation format and work ok in the example below,
Tr_Auto_Enrolment = VAR Count_Auto = CALCULATE(COUNT(tbl_Biz_Quest[Tr_Auto Enrolment]), tbl_Biz_Quest[Tr_Auto Enrolment] = "Automated")
VAR Count_Manual = CALCULATE(COUNT(tbl_Biz_Quest[Tr_Auto Enrolment]), tbl_Biz_Quest[Tr_Auto Enrolment] = "Manual")
VAR Count_No = CALCULATE(COUNT(tbl_Biz_Quest[Tr_Auto Enrolment]), tbl_Biz_Quest[Tr_Auto Enrolment] = "No")
RETURN
    SWITCH (
        TRUE (),
        Count_Auto >= Count_Manual && Count_Auto >= Count_No && Count_Auto > 0, [Check_Mark],
        Count_Manual > Count_Auto && Count_Manual >= Count_No && Count_Manual > 0, [Exclamation_Mark],
        Count_No > Count_Auto && Count_No > Count_Manual && Count_No > 0, [Slash_Mark],
        ""
    )
 
the results of each measure are UNICHARs ([Check_Mark]=UNICHAR(128504), [Exclamation_Mark]=UNICHAR(33), [Slash_Mark]=UNICHAR(9644))
 
 
For example, if the visual uses the measure [Tr_Auto_Enrolment] and the result is equal to [Check_Mark] the tooltip should show this "TR_ENROLMENTE CHECK " & "<span style = 'font-weight: bold'> " & FORMAT([%Login], "0%") & "</span>" & " of A&P spend" however the result is "", does anyone know another way to do it, I wouldn't want to separately make a tooltip for everyone would like to make it dynamic 😞

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi wmendes17 ,

     

    I think you're on the right path, but the problem is with each result, you start by defining it as a measure that returns a result for all three cases, e.g. [Tr_Auto_Enrolment]=[Check_Mark], I think you mean parent-child relationship, but logically from the calculations you need the two to be equal. If [Tr_Auto_Enrolment] is 1 and [Check_Mark] is 1.1, it doesn't seem to execute.

     

    Please feel free to correct me and provide more information if I have misunderstood you!

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

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