<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SVG Color Star Rating in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/SVG-Color-Star-Rating/m-p/532717#M234</link>
    <description>&lt;P&gt;If there was an ability to display partial stars that would make it even more useful.&amp;nbsp; Very good work!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Oct 2018 15:00:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-10-03T15:00:17Z</dc:date>
    <item>
      <title>SVG Color Star Rating</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/SVG-Color-Star-Rating/m-p/505223#M207</link>
      <description>&lt;P&gt;First, I would say that this is a bit of a work in progress as I want to add scaling and more shapes to this. Second, this measure builds off of&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="79" data-lia-user-login="cwebb" class="lia-mention lia-mention-user"&gt;cwebb&lt;/a&gt;'s Star Rating Quick Measure that was included in the Power BI Desktop. Essentially, the desire was to move beyond the limitations of unicode characters to achieve star ratings with colors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Color Star Rating = 
VAR __MAX_NUMBER_OF_STARS = 5
VAR __MIN_RATED_VALUE = 0
VAR __MAX_RATED_VALUE = 5
VAR __BASE_VALUE = SUM([Score])
VAR __NORMALIZED_BASE_VALUE =
	MIN(
		MAX(
			DIVIDE(
				__BASE_VALUE - __MIN_RATED_VALUE,
				__MAX_RATED_VALUE - __MIN_RATED_VALUE
			),
			0
		),
		1
	)
VAR __STAR_RATING = ROUND(__NORMALIZED_BASE_VALUE * __MAX_NUMBER_OF_STARS, 0)
VAR __shape = "Star"
VAR __color = "Red"
VAR __backgroundColor = "White"
VAR __radius = 9
VAR __opacity = 0.75
VAR __header = "data&amp;amp;colon;image/svg+xml;utf8," &amp;amp;
              "&amp;lt;svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='" &amp;amp; 20*__MAX_RATED_VALUE &amp;amp; "' height='20'&amp;gt;"
VAR __footer = "&amp;lt;/svg&amp;gt;"
VAR __shapeTextCircle = "&amp;lt;circle cx='10' cy='10' r='" &amp;amp; __radius &amp;amp; "' fill='" &amp;amp; __color &amp;amp; "' fill-opacity='" &amp;amp; __opacity &amp;amp; "' /&amp;gt;"
VAR __shapeTextTriangle = "&amp;lt;polygon points=""0,20 20,20 10,0"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextDot = "&amp;lt;circle cx='10' cy='10' r='" &amp;amp; 1 &amp;amp; "' fill='" &amp;amp; __color &amp;amp; "' fill-opacity='" &amp;amp; __opacity &amp;amp; "' /&amp;gt;"
VAR __shapeTextSquare = "&amp;lt;polygon points=""0,20 0,0, 20,1 20,20"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextDiamond = "&amp;lt;polygon points=""10,0 20,10, 10,20 0,10"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextRect = "&amp;lt;polygon points=""0,20 0,0, 40,1 40,20"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextHex = "&amp;lt;polygon points=""10,0 20,4 20,16 10,20 0,16 0,4"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextOct = "&amp;lt;polygon points=""6,0 14,0 20,6 20,14 14,20 6,20 0,14 0,6"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextPent = "&amp;lt;polygon points=""10,0 20,8 16,20 4,20 0,8"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStar1 = "&amp;lt;polygon points=""10,0 12,9 20,8 13,13 16,20 10,15 4,20 7,13 0,9 8,9"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStar2 = "&amp;lt;polygon points=""30,0 32,9 40,8 33,13 36,20 30,15 24,20 27,13 20,9 28,9"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStar3 = "&amp;lt;polygon points=""50,0 52,9 60,8 53,13 56,20 50,15 44,20 47,13 40,9 48,9"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStar4 = "&amp;lt;polygon points=""70,0 72,9 80,8 73,13 76,20 70,15 64,20 67,13 60,9 68,9"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStar5 = "&amp;lt;polygon points=""90,0 92,9 100,8 93,13 96,20 90,15 84,20 87,13 80,9 88,9"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 

VAR __shapeTextCircleBackground = "&amp;lt;circle cx='10' cy='10' r='" &amp;amp; __radius &amp;amp; "' fill='" &amp;amp; __backgroundColor &amp;amp; "' fill-opacity='" &amp;amp; __opacity &amp;amp; "' /&amp;gt;"
VAR __shapeTextTriangleBackground = "&amp;lt;polygon points=""0,20 20,20 10,0"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextDotBackground = "&amp;lt;circle cx='10' cy='10' r='" &amp;amp; 1 &amp;amp; "' fill='" &amp;amp; __backgroundColor &amp;amp; "' fill-opacity='" &amp;amp; __opacity &amp;amp; "' /&amp;gt;"
VAR __shapeTextSquareBackground = "&amp;lt;polygon points=""0,20 0,0, 20,1 20,20"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextDiamondBackground = "&amp;lt;polygon points=""10,0 20,10, 10,20 0,10"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextRectBackground = "&amp;lt;polygon points=""0,20 0,0, 40,1 40,20"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextHexBackground = "&amp;lt;polygon points=""10,0 20,4 20,16 10,20 0,16 0,4"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextOctBackground = "&amp;lt;polygon points=""6,0 14,0 20,6 20,14 14,20 6,20 0,14 0,6"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextPentBackground = "&amp;lt;polygon points=""10,0 20,8 16,20 4,20 0,8"" style=""fill:" &amp;amp; __color &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:0;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStarBackground1 = "&amp;lt;polygon cx='0' cy='0' points=""10,0 12,9 20,8 13,13 16,20 10,15 4,20 7,13 0,9 8,9"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:1;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStarBackground2 = "&amp;lt;polygon points=""30,0 32,9 40,8 33,13 36,20 30,15 24,20 27,13 20,9 28,9"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:1;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStarBackground3 = "&amp;lt;polygon points=""50,0 52,9 60,8 53,13 56,20 50,15 44,20 47,13 40,9 48,9"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:1;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStarBackground4 = "&amp;lt;polygon points=""70,0 72,9 80,8 73,13 76,20 70,15 64,20 67,13 60,9 68,9"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:1;fill-rule:evenodd;"" /&amp;gt;" 
VAR __shapeTextStarBackground5 = "&amp;lt;polygon points=""90,0 92,9 100,8 93,13 96,20 90,15 84,20 87,13 80,9 88,9"" style=""fill:" &amp;amp; __backgroundColor &amp;amp; ";stroke:" &amp;amp; __color &amp;amp; ";stroke-width:1;fill-rule:evenodd;"" /&amp;gt;" 

VAR __shapeText1 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangle,
        "Circle",__shapeTextCircle,
        "Dot",__shapeTextDot,
        "Square",__shapeTextSquare,
        "Rectangle",__shapeTextRect,
        "Hexagon",__shapeTextHex,
        "Octagon",__shapeTextOct,
        "Pentagon",__shapeTextPent,
        "Star",__shapeTextStar1,
        "Diamond",__shapeTextDiamond,
        __shapeTextStar1
    )
VAR __shapeText2 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangle,
        "Circle",__shapeTextCircle,
        "Dot",__shapeTextDot,
        "Square",__shapeTextSquare,
        "Rectangle",__shapeTextRect,
        "Hexagon",__shapeTextHex,
        "Octagon",__shapeTextOct,
        "Pentagon",__shapeTextPent,
        "Star",__shapeTextStar2,
        "Diamond",__shapeTextDiamond,
        __shapeTextStar2
    )
VAR __shapeText3 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangle,
        "Circle",__shapeTextCircle,
        "Dot",__shapeTextDot,
        "Square",__shapeTextSquare,
        "Rectangle",__shapeTextRect,
        "Hexagon",__shapeTextHex,
        "Octagon",__shapeTextOct,
        "Pentagon",__shapeTextPent,
        "Star",__shapeTextStar3,
        "Diamond",__shapeTextDiamond,
        __shapeTextStar3
    )
VAR __shapeText4 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangle,
        "Circle",__shapeTextCircle,
        "Dot",__shapeTextDot,
        "Square",__shapeTextSquare,
        "Rectangle",__shapeTextRect,
        "Hexagon",__shapeTextHex,
        "Octagon",__shapeTextOct,
        "Pentagon",__shapeTextPent,
        "Star",__shapeTextStar4,
        "Diamond",__shapeTextDiamond,
        __shapeTextStar4
    )
VAR __shapeText5 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangle,
        "Circle",__shapeTextCircle,
        "Dot",__shapeTextDot,
        "Square",__shapeTextSquare,
        "Rectangle",__shapeTextRect,
        "Hexagon",__shapeTextHex,
        "Octagon",__shapeTextOct,
        "Pentagon",__shapeTextPent,
        "Star",__shapeTextStar5,
        "Diamond",__shapeTextDiamond,
        __shapeTextStar5
    )

VAR __shapeTextBackground1 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangleBackground,
        "Circle",__shapeTextCircleBackground,
        "Dot",__shapeTextDotBackground,
        "Square",__shapeTextSquareBackground,
        "Rectangle",__shapeTextRectBackground,
        "Hexagon",__shapeTextHexBackground,
        "Octagon",__shapeTextOctBackground,
        "Pentagon",__shapeTextPentBackground,
        "Star",__shapeTextStarBackground1,
        "Diamond",__shapeTextDiamondBackground,
        __shapeTextStarBackground1
    )
VAR __shapeTextBackground2 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangleBackground,
        "Circle",__shapeTextCircleBackground,
        "Dot",__shapeTextDotBackground,
        "Square",__shapeTextSquareBackground,
        "Rectangle",__shapeTextRectBackground,
        "Hexagon",__shapeTextHexBackground,
        "Octagon",__shapeTextOctBackground,
        "Pentagon",__shapeTextPentBackground,
        "Star",__shapeTextStarBackground2,
        "Diamond",__shapeTextDiamondBackground,
        __shapeTextStarBackground2
    )
VAR __shapeTextBackground3 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangleBackground,
        "Circle",__shapeTextCircleBackground,
        "Dot",__shapeTextDotBackground,
        "Square",__shapeTextSquareBackground,
        "Rectangle",__shapeTextRectBackground,
        "Hexagon",__shapeTextHexBackground,
        "Octagon",__shapeTextOctBackground,
        "Pentagon",__shapeTextPentBackground,
        "Star",__shapeTextStarBackground3,
        "Diamond",__shapeTextDiamondBackground,
        __shapeTextStarBackground3
    )
VAR __shapeTextBackground4 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangleBackground,
        "Circle",__shapeTextCircleBackground,
        "Dot",__shapeTextDotBackground,
        "Square",__shapeTextSquareBackground,
        "Rectangle",__shapeTextRectBackground,
        "Hexagon",__shapeTextHexBackground,
        "Octagon",__shapeTextOctBackground,
        "Pentagon",__shapeTextPentBackground,
        "Star",__shapeTextStarBackground4,
        "Diamond",__shapeTextDiamondBackground,
        __shapeTextStarBackground4
    )
VAR __shapeTextBackground5 = 
    SWITCH(__shape,
        "Triangle",__shapeTextTriangleBackground,
        "Circle",__shapeTextCircleBackground,
        "Dot",__shapeTextDotBackground,
        "Square",__shapeTextSquareBackground,
        "Rectangle",__shapeTextRectBackground,
        "Hexagon",__shapeTextHexBackground,
        "Octagon",__shapeTextOctBackground,
        "Pentagon",__shapeTextPentBackground,
        "Star",__shapeTextStarBackground5,
        "Diamond",__shapeTextDiamondBackground,
        __shapeTextStarBackground5
    )

VAR __rating = 
	IF(
		NOT ISBLANK(__BASE_VALUE),
        SWITCH(__STAR_RATING,
            0,__shapeTextBackground1&amp;amp;__shapeTextBackground2&amp;amp;__shapeTextBackground3&amp;amp;__shapeTextBackground4&amp;amp;__shapeTextBackground5,
            1,__shapeText1&amp;amp;__shapeTextBackground2&amp;amp;__shapeTextBackground3&amp;amp;__shapeTextBackground4&amp;amp;__shapeTextBackground5,
            2,__shapeText1&amp;amp;__shapeText2&amp;amp;__shapeTextBackground3&amp;amp;__shapeTextBackground4&amp;amp;__shapeTextBackground5,
            3,__shapeText1&amp;amp;__shapeText2&amp;amp;__shapeText3&amp;amp;__shapeTextBackground4&amp;amp;__shapeTextBackground5,
            4,__shapeText1&amp;amp;__shapeText2&amp;amp;__shapeText3&amp;amp;__shapeText4&amp;amp;__shapeTextBackground5,
            5,__shapeText1&amp;amp;__shapeText2&amp;amp;__shapeText3&amp;amp;__shapeText4&amp;amp;__shapeText5,
            ""
        )   
	)
VAR __return = __header &amp;amp; __rating &amp;amp; __footer
RETURN __return&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiNTc0YjZlZmMtOTUzMC00OWRiLWFjZTYtMmU0ZmQ1MGFhNDFlIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Sep 2018 15:54:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/SVG-Color-Star-Rating/m-p/505223#M207</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2018-09-02T15:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: SVG Color Star Rating</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/SVG-Color-Star-Rating/m-p/532717#M234</link>
      <description>&lt;P&gt;If there was an ability to display partial stars that would make it even more useful.&amp;nbsp; Very good work!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 15:00:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/SVG-Color-Star-Rating/m-p/532717#M234</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-03T15:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: SVG Color Star Rating</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/SVG-Color-Star-Rating/m-p/532796#M236</link>
      <description>&lt;P&gt;I totally agree with that and I was thinking along those lines when I created it but haven't arrived at the solution to that issue quite yet!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 16:30:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/SVG-Color-Star-Rating/m-p/532796#M236</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2018-10-03T16:30:36Z</dc:date>
    </item>
  </channel>
</rss>

