Forum Discussion

rsbin's avatar
rsbin
Community Champion
6 years ago

Customize Tooltip for Stacked Column Chart

Good Afternoon,

Have searched the Board for an answer, but to no avail.

I am deploying a 100% stacked bar chart wherein I am summing total seconds (in the hundreds of thousands).

I have created a new measure which converts seconds into hh:mm:ss format (Formatted Measure).

Other than creating a Custom Tooltip Page, is there a quick way to get the Tooltip to refer to this Formatted Measure instead of the Measure in total seconds?

If I drag the Formatted Measure into the Tooltip field well, it shows for all groupings in my stacked column.  I only want it to refer to the group selected.

If I have to create a custom tootip page then I can do that.

 

Thanks much and appreciate any suggestions!

 

 

15 Replies

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

    Hi rsbin ,

     

    Sorry for that we don’t understand your requirement clearly.

    If you mean not to display the EquipIDDuration data, this does not seem to be possible. Because the fields in Values must be displayed in Tooltips. It is a default function.

     

     

    The specific operation steps refer to this article.

    If you have any question, please kindly ask here and we will try to resolve it.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

    • rsbin's avatar
      rsbin
      Community Champion

      v-zhenbw-msft 

      The data in EquipIDDuration is in total seconds.

      I need to use that field to properly display the stacked column chart.  However displaying seconds in the hundreds of thousands is meaningless to the User.

      I would like to replace EquipIDDuration with another measure called EquipID_Formatted which is formatted in the equivalent of hh:mm:ss which will be much more meaningful.

      My question is can this be done without creating an entirely new Tooltip Report Page.   I just want to change the display of that one value.

      Appreciate your thoughts and suggestions.

       

      Best Regards,

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

    Hi rsbin ,

     

    We understand your requirement, but unfortunately Power BI cannot replace EquipIDDuration with another measure called EquipID_Formatted.

    Because the “hh:mm:ss” format is a text type and when you put a text type to Values, it just count it.

     

     

    So we just can create a hh:mm:ss column and add it to tooltip.

     

    hh:mm:ss = 
    INT('Table'[time] / 3600) & ":" &
    RIGHT("0" & INT(('Table'[time] - INT('Table'[time]/ 3600) * 3600) / 60), 2) & ":" &
    RIGHT("0" & MOD('Table'[time], 3600), 2)

     

    The result like this,

     

     

    If you have any question, please kindly ask here and we will try to resolve it.

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

    • rsbin's avatar
      rsbin
      Community Champion

      Good Morning v-zhenbw-msft 

       

      Thank you for the response.  I examined your pbix file to see how you set this up.  I see you created a table so that the formatted value changes for each value in the column.   I am using Measures for all of my calculations. 

      These Measures, when brought into the stacked column chart are filtered by several slicers on the page.  I can slice by Date, Facility, and other variables. 

      I do not know how I would convert these Measures into a "table" as you have done and still keep all of the contextual filters.

      If you have any further advice or suggestions, I would be most appreciative.

       

      Again, thank you for taking the time to respond.

       

      Kindest regards,

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

        Hi rsbin ,

         

        You can replace the hh:mm:ss column with this measure and put the measure to Tooltips. But you cannot put this measure to Values, because it is text type.

         

        EquipID_Formatted = 
        INT ( [EquipIDDuration] / 3600 ) & ":"
            & RIGHT (
                "0"
                    & INT ( ( [EquipIDDuration] - INT ( [EquipIDDuration] / 3600 ) * 3600 ) / 60 ),
                2
            ) & ":"
        & RIGHT ( "0" & MOD ( [EquipIDDuration], 3600 ), 2 )

         

        The result like this,

         

         

        If you have any question, please kindly ask here and we will try to resolve it.

        BTW, pbix as attached.

         

        Best regards,

         

        Community Support Team _ zhenbw

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    How did you create the new measure to converts seconds into hh:mm:ss format (Formatted Measure)?

    • rsbin's avatar
      rsbin
      Community Champion

      Good Morning Anonymous 

       

      Found the following code in another thread.  Can't recall who provided it.  I have seen various ways to do this, but this one works for me:

       

      EquipIDDuration_Format = 
      VAR hours =
          ROUNDDOWN ( [EquipIDDuration] / 3600, 0 )
      VAR minutes =
          ROUNDDOWN ( MOD ( [EquipIDDuration], 3600 ) / 60, 0 )
      VAR seconds =
          INT ( MOD ( [EquipIDDuration], 60 ) )
      RETURN
          FORMAT(hours,"00") & ":"
              & FORMAT(minutes, "00")
              & ":"
              & FORMAT(seconds, "00")

      [EquipIDDuration] is the original measure calculated in seconds.

      If you download the pbix attached in this thread, v-zhenbw-msft has also provided something similar.

       

      Good Luck and best regards,

      • Anonymous's avatar
        Anonymous
        Not applicable

        I am still doing something wrong; am also a newbie.  I created a custom col as picture indicates, but it doesn't like the format.  Also, I really needs days too because 1 million seconds converts to 11 days 13:46:40 per Tools4Noobs.  Thanks, Sandra

         

         

  • Hi rsbin,

     

    Here is Stacked Column Chart with Custom Tooltip which will help you get separate or ungrouped tooltip for each stack.

     

     

    Custom Tooltip Stacked Column Chart PBIVizEdit.comStacked Column Chart with custom tooltip PBIVizEdit.com 

    Download link for the custom visual file in this page

    https://pbivizedit.com/gallery/stacked-column-with-custom-tooltip 

     

    This was made with our Custom Visual creator tool PBIVizEdit.com. With this tool,

    • anyone, irrespective of technical skills, can create their own visuals
    • 15 minutes to create a visual from scratch
    • opens up many additional attributes to edit (for e.g. labels, tooltips, legends position, etc)

    Give this a shot and let us know if you face any problem/errors.
    You can use the editor to modify your visual further (some modifications cannot be done in Power BI window and have to be in editor).

    Thanks,
    Team PBIVizEdit