Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Dynamic bubble chart percentages

Hello, 

 

I have dynamics bubble chart .

 

 

 

 

 

 

 

 

The code is here:

KPI =
VAR kpiColor = "#00BFFF" 
VAR kpiBlock = "data&colon;image/svg+xml;utf8,<svg height='400' width='400' xmlns='http://www.w3.org/2000/svg'><circle cx='200' cy='200' r='"
& FORMAT([KPI Radius]; "###" )
& "' stroke='"
& kpiColor
& "' stroke-width='1' fill='"
& kpiColor
& "' />"
& " <text x='50%' y='50%' text-anchor='middle' stroke='balck' stroke-width='2px' dy='.3em'>"
& [OG YTD]
& "</text>"
& "</svg>"
RETURN
IF (HASONEFILTER( Finance[Hierarchy Level] ); kpiBlock )

 

My problem is, that the "OG YTD" is a percentage value, but int chart the bubble contains a very long number, not the correct percentage. 

 

Thank you, 

Anett 

  • Hi Anonymous ,

     

    Try to change your measure in order to format the OG YTD measure something similar to this:

     

    KPI =
    VAR kpiColor = "#00BFFF"
    VAR kpiBlock =
        "data&colon;image/svg+xml;utf8,<svg height='400' width='400' xmlns='http://www.w3.org/2000/svg'><circle cx='200' cy='200' r='"
            & FORMAT ( [KPI Radius]; "###" ) & "' stroke='" & kpiColor & "' stroke-width='1' fill='" & kpiColor & "' />" & " <text x='50%' y='50%' text-anchor='middle' stroke='balck' stroke-width='2px' dy='.3em'>"
            & FORMAT ( [OG YTD]; "## %" ) & "</text>" & "</svg>"
    RETURN
        IF ( HASONEFILTER ( Finance[Hierarchy Level] ); kpiBlock )

6 Replies

  • Hi Anonymous ,

     

    Try to change your measure in order to format the OG YTD measure something similar to this:

     

    KPI =
    VAR kpiColor = "#00BFFF"
    VAR kpiBlock =
        "data&colon;image/svg+xml;utf8,<svg height='400' width='400' xmlns='http://www.w3.org/2000/svg'><circle cx='200' cy='200' r='"
            & FORMAT ( [KPI Radius]; "###" ) & "' stroke='" & kpiColor & "' stroke-width='1' fill='" & kpiColor & "' />" & " <text x='50%' y='50%' text-anchor='middle' stroke='balck' stroke-width='2px' dy='.3em'>"
            & FORMAT ( [OG YTD]; "## %" ) & "</text>" & "</svg>"
    RETURN
        IF ( HASONEFILTER ( Finance[Hierarchy Level] ); kpiBlock )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi MFelix , 

       

      Thank you, it's working. 

      Can you help me with the font size too? Now the font size is tiny, but the the Visualization "Format" funkcion not effect it. I think I should make some change in the code. 

       

      Thank you, 

      Anett 

      • MFelix's avatar
        MFelix
        Super User

        Hi Anonymous ,

         

        what is the visualizationyou are using? Some custom visualizations don't have the chance to change font size.

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

      Hi Anonymous ,

       

      Like MFelix said, try to add font size property to the text label.

       

      Best regards,
      Lionel Chen

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