<?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: How to calculate a ranking score between 1 &amp;amp; 5 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4280360#M169869</link>
    <description>&lt;P&gt;Yes, you're absolutely correct. The `_AvgCompleted` measure is likely including the zeros in its calculation, which is why it's producing a very low average (0.13). To fix this, you should modify `_AvgCompleted` to only average non-zero entries in the `Completed` column, which will give you the actual average for entries that meet the "Completed" criteria.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Updated `_AvgCompleted` Calculation&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can adjust `_AvgCompleted` to ignore zeros by using the `FILTER` function to only consider rows where `Completed` is 1. Here’s the revised measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAX&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_AvgCompleted = AVERAGEX(FILTER(ALL('table1'), 'table1'[Completed] = 1), 'table1'[Completed])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This change will calculate the average for only the rows where `Completed` equals 1, which should correct the `_5_star_rating` calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Revised `_5_star_rating` Measure&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now that `_AvgCompleted` accurately represents only the completed tasks, your `_5_star_rating` calculation should work as expected:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DAX&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_5_star_rating =
VAR _AvgCompleted = AVERAGEX(FILTER(ALL('table1'), 'table1'[Completed] = 1), 'table1'[Completed])
VAR _Completed = SUM('table1'[Completed])
VAR _RatingScale = DIVIDE(_Completed, _AvgCompleted)
VAR _star = INT(MIN(5, ROUNDUP(_RatingScale, 0))) // Limit rating to a max of 5 stars
RETURN
REPT(UNICHAR(11088), _star) // Unicode for a filled star&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Explanation&lt;/STRONG&gt;&lt;BR /&gt;1.&lt;STRONG&gt; _AvgCompleted:&lt;/STRONG&gt; Averages only the rows where `Completed = 1`.&lt;BR /&gt;2. &lt;STRONG&gt;_Completed:&lt;/STRONG&gt; Sums the completed tasks for each person.&lt;BR /&gt;3. &lt;STRONG&gt;_RatingScale&lt;/STRONG&gt;: Divides the individual’s completed tasks by the adjusted average.&lt;BR /&gt;4.&lt;STRONG&gt; _star:&lt;/STRONG&gt; Rounds up the rating scale, capping it at a maximum of 5 stars.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this adjustment, `_5_star_rating` should now accurately reflect the intended star rating based on the average completion of non-zero entries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Please mark this as solution if it helps you. Appreciate Kudos.&lt;/STRONG&gt;&lt;/EM&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Nov 2024 18:17:31 GMT</pubDate>
    <dc:creator>FarhanJeelani</dc:creator>
    <dc:date>2024-11-12T18:17:31Z</dc:date>
    <item>
      <title>How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279680#M169830</link>
      <description>&lt;P&gt;Hi there, I am having a bit of a maths &amp;amp; dax failure and hoping that one of you amazing people can help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to calculate a ‘5 star rating’ for the ‘completed’ column in relation to the average number of ‘completed’. The idea is to provide a ranking of how many each person has completed. Please see example below of the rating that I am trying to achieve in a table visual. The column '&lt;STRONG&gt;_5_star_rating&lt;/STRONG&gt;' shows a small graphic of stars 0 to 5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table visual&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Completed&lt;/TD&gt;&lt;TD&gt;_5_star_rating (out of 5)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;700&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person2&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person3&lt;/TD&gt;&lt;TD&gt;414&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ‘&lt;STRONG&gt;Name&lt;/STRONG&gt;’ and ‘&lt;STRONG&gt;Completed&lt;/STRONG&gt;’ columns are taken from ‘&lt;STRONG&gt;table1&lt;/STRONG&gt;’ and look something like this:-&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Completed&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;i.e Person1 will have 700 rows that = 1, Person2 will have 200 rows that = 1 &amp;amp; Person3 will have 414 rows that = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the measure that I currently have for the ‘&lt;STRONG&gt;_5_star_rating&lt;/STRONG&gt;’.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_5_star_rating =

Var _star = INT(DIVIDE(SUM(table1[Completed]),100))

VAR _unstar = 5 - _star

RETURN

REPT(UNICHAR(11088),_star)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;It partly works. It currently returns a graphic of stars 0 to 5, but the calculation doesnt work out the 1 to 5 ratings in relation to an overall ranking for each person under '&lt;STRONG&gt;Name&lt;/STRONG&gt;'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas eternally appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks as always&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CF&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 10:35:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279680#M169830</guid>
      <dc:creator>ClemFandango</dc:creator>
      <dc:date>2024-11-12T10:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279711#M169831</link>
      <description>&lt;P&gt;To calculate a 5-star rating that ranks each person’s "Completed" count relative to others, you can normalize the "Completed" values between 1 and 5 based on their relative position. Here's how you can approach this in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Step-by-Step Solution&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Calculate the Minimum and Maximum Completed Values&lt;/STRONG&gt;: First, you need the minimum and maximum values of the "Completed" column to create a scale.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Normalize the Score:&lt;/STRONG&gt; Use these values to scale each person’s "Completed" count between 1 and 5. This way, the lowest "Completed" count will be 1 star, and the highest will be 5 stars.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. Generate Star Symbols:&lt;/STRONG&gt; Convert this scaled score to a visual star rating by repeating a star symbol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;DAX Measure for 5-Star Rating&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here's a DAX measure to implement the above steps:&lt;/P&gt;&lt;P&gt;DAX&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_5_star_rating =
VAR MinCompleted = CALCULATE(MIN(table1[Completed]), ALL(table1))
VAR MaxCompleted = CALCULATE(MAX(table1[Completed]), ALL(table1))
VAR CompletedCount = SUM(table1[Completed])

// Normalize the Completed count between 1 and 5
VAR NormalizedScore =
1 + ((CompletedCount - MinCompleted) / (MaxCompleted - MinCompleted)) * 4

// Round the normalized score to an integer
VAR StarRating = ROUND(NormalizedScore, 0)

// Create star symbols
RETURN REPT(UNICHAR(11088), StarRating)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Notes&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;- This measure dynamically adjusts the rating based on the range of "Completed" values in your data, so it should work even if new names or completed counts are added.&lt;BR /&gt;- You can replace `UNICHAR(11088)` with a different symbol if you prefer a different star style.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example Output&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;For the table you provided:&lt;/P&gt;&lt;P&gt;| Name | Completed | _5_star_rating (out of 5) |&lt;BR /&gt;|----------|-----------|---------------------------|&lt;BR /&gt;| Person1 | 700 | &lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt; |&lt;BR /&gt;| Person2 | 200 | &lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt; |&lt;BR /&gt;| Person3 | 414 | &lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":star:"&gt;⭐&lt;/span&gt; |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should yield a more accurate star ranking based on each person's completed count relative to the others. Let me know if you need further adjustments!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Please accept this as solution if it helps. Appreciate Kudos.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 10:59:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279711#M169831</guid>
      <dc:creator>FarhanJeelani</dc:creator>
      <dc:date>2024-11-12T10:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279715#M169832</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="478905" data-lia-user-login="ClemFandango" class="lia-mention lia-mention-user"&gt;ClemFandango&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To achieve the 5-star rating based on each person's completion count relative to the average completion count, we need to calculate how each individual’s completion count compares to the average. Here’s an approach using DAX:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;Calculate the Average Completion: Compute the average of completed tasks across all people.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Determine the 5-Star Rating Scale: Scale each person’s completion count relative to the average.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Generate Stars as a Visual Representation: Use UNICHAR to display stars based on the calculated rating.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;LI-CODE lang="markup"&gt;_5_star_rating = 
VAR _AvgCompleted = AVERAGEX(ALL(table1), CALCULATE(SUM(table1[Completed])))
VAR _Completed = SUM(table1[Completed])
VAR _RatingScale = DIVIDE(_Completed, _AvgCompleted)
VAR _star = INT(MIN(5, ROUNDUP(_RatingScale, 0))) // Limit rating to max of 5
RETURN 
REPT(UNICHAR(11088), _star) // Unicode for a filled star
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;This measure should dynamically adjust each person’s rating based on their performance relative to the group average. Adjust the scaling factor if you need to fine-tune the distribution across the 5-star range.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 11:04:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279715#M169832</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-11-12T11:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279784#M169834</link>
      <description>&lt;P&gt;Hi both!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very impressive and super quick!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunatley, I still cant get it to work - obviously it is something that I am doing wrong.&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;&amp;nbsp; the result i get using your measue is 5 stars for everything, with the occational blank star&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="833383" data-lia-user-login="FarhanJeelani" class="lia-mention lia-mention-user"&gt;FarhanJeelani&lt;/a&gt;&amp;nbsp; i get 100's of stars using this methodology&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could it be something to do with my 'Completed' calculated column?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Completed = 

IF(
('Table1'[Type] IN {"a", "b", "c"} &amp;amp;&amp;amp; ' Table1'[Status] = "Completed" &amp;amp;&amp;amp; MONTH('Table1'[End]) = MONTH(TODAY()) - 1 &amp;amp;&amp;amp; YEAR(' Table1'[End]) = YEAR(TODAY()))
||
(' Table1'[Type] = "d" &amp;amp;&amp;amp; ' Table1'[Status] = "Completed" &amp;amp;&amp;amp; MONTH(' Table1'[Last Updated]) = MONTH(TODAY()) - 1 &amp;amp;&amp;amp; YEAR(' Table1'[Last Updated]) = YEAR(TODAY()))
||
(' Table1'[Type] IN {"a", "b", "c"} &amp;amp;&amp;amp; ' Table1'[Status] = "Completed" &amp;amp;&amp;amp; MONTH(' Table1'[End]) = MONTH(TODAY()) &amp;amp;&amp;amp; YEAR(' Table1'[End]) = YEAR(TODAY()))
||
(' Table1'[Type] = "d" &amp;amp;&amp;amp; ' Table1'[Status] = "Completed" &amp;amp;&amp;amp; MONTH(' Table1'[Last Updated]) = MONTH(TODAY())  &amp;amp;&amp;amp; YEAR(' Table1'[Last Updated]) = YEAR(TODAY())
),calculate (COUNTROWS(Table1), allexcept(Table1, Table1 [ID])),0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above '&lt;STRONG&gt;Completed&lt;/STRONG&gt;' column returns a 1 where all of the above conditions are met. It works in terms of what I am trying to calculate in the column, it just doesnt calculate correctly in the '&lt;STRONG&gt;_5_star_rating&lt;/STRONG&gt;' measures. Could this be because I also have 0's? (i forgot the mention these in my first post)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table1&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Completed&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;FONT size="3"&gt;i.e Person1 will have 700 rows that = 1, Person2 will have 200 rows that = 1 &amp;amp; Person3 will have 414 rows that = 1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Any ideas where I am going wrong?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 12:22:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279784#M169834</guid>
      <dc:creator>ClemFandango</dc:creator>
      <dc:date>2024-11-12T12:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279805#M169837</link>
      <description>&lt;P&gt;Yes, the issue could be related to the `Completed` calculated column. From your description, it looks like the `Completed` column may be returning values that are too large, which is why you're seeing hundreds of stars when you calculate the rating.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Why is this happening?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The `Completed` calculated column is using a `COUNTROWS` function, which returns the count of rows for each ID, and it is not aggregated in a way that scales properly for your rating calculation. In your case, if `COUNTROWS` is returning large numbers, that could cause the `SUM(table1[Completed])` in your `_5_star_rating` measure to become disproportionately large, resulting in many stars.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Potential Fix:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Check the Logic of the `Completed` Column:&lt;/STRONG&gt; The `Completed` column logic you provided counts the number of rows that meet certain criteria, and that count may be too large when summed across all rows in `table1`. You might want to check the values of `Completed` in your data to confirm they are appropriate for your rating calculation.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Reconsider the Aggregation in the `_5_star_rating` Measure&lt;/STRONG&gt;: Instead of summing `Completed`, you may need to adjust how you are calculating the average completed count. For example, consider directly calculating the rating based on a more refined logic that takes into account the counts or percentages instead of raw row counts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Modified DAX for `_5_star_rating`:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Try updating the `_5_star_rating` measure with a more controlled logic that ensures the `Completed` values are appropriately handled:&lt;/P&gt;&lt;P&gt;DAX&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_5_star_rating =
VAR _AvgCompleted = AVERAGEX(ALL('table1'), CALCULATE(SUM('table1'[Completed])))
VAR _Completed = SUM('table1'[Completed])
VAR _RatingScale = DIVIDE(_Completed, _AvgCompleted)
VAR _star = INT(MIN(5, ROUNDUP(_RatingScale, 0))) // Limit rating to a max of 5 stars
RETURN
REPT(UNICHAR(11088), _star) // Unicode for a filled star&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this formula:&lt;BR /&gt;- SUM('table1'[Completed]): This calculates the sum of the `Completed` column values for the current context.&lt;BR /&gt;- AVERAGEX(ALL('table1'), ...): This is calculating the average of the `Completed` values across all rows in `table1`, removing any filters.&lt;/P&gt;&lt;P&gt;If the `Completed` column still has an unexpectedly high value, consider modifying the column definition to avoid large counts or use a different aggregation method (e.g., percentages or a simple flag indicating completion).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Debugging Steps:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;- &lt;STRONG&gt;Step 1:&lt;/STRONG&gt; Check the actual values in the `Completed` column for a few rows. This will help confirm if the counts are indeed too large.&lt;BR /&gt;- &lt;STRONG&gt;Step 2&lt;/STRONG&gt;: Test your `_5_star_rating` measure with a simple sum or average to see if the calculated values make sense.&lt;BR /&gt;&lt;BR /&gt;This will help you control the number of stars displayed and ensure the rating is calculated correctly.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 12:19:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279805#M169837</guid>
      <dc:creator>FarhanJeelani</dc:creator>
      <dc:date>2024-11-12T12:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279924#M169850</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="833383" data-lia-user-login="FarhanJeelani" class="lia-mention lia-mention-user"&gt;FarhanJeelani&lt;/a&gt;&amp;nbsp; thanks for the detailed explanation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think you have nailed the bit that i am struggling with.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_5_star_rating =
VAR _AvgCompleted = AVERAGEX(ALL('table1'), CALCULATE(SUM('table1'[Completed])))
VAR _Completed = SUM('table1'[Completed])
VAR _RatingScale = DIVIDE(_Completed, _AvgCompleted)
VAR _star = INT(MIN(5, ROUNDUP(_RatingScale, 0))) // Limit rating to a max of 5 stars
RETURN
REPT(UNICHAR(11088), _star) // Unicode for a filled star&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what the&amp;nbsp;&lt;STRONG&gt;Table visual &lt;/STRONG&gt;currently&amp;nbsp;looks like with&amp;nbsp;the _5_star_rating measure broken down.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;_Completed&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;_5_star_rating (not working)&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;_AvgCompleted&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;_RatingScale&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;66&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0.13&lt;/TD&gt;&lt;TD&gt;490.66&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person2&lt;/TD&gt;&lt;TD&gt;55&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0.13&lt;/TD&gt;&lt;TD&gt;408.88&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person3&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0.13&lt;/TD&gt;&lt;TD&gt;230.46&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table used to calculate _completed looks like this&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table1&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Completed&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Person3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN&gt;i.e Person1 will have 66 rows that = 1, Person2 will have 55 rows that = 1 &amp;amp; Person3 will have 31 rows that = 1. No person has more than 1 in the 'Completed' column, but there are thousands of zeros.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Completed = 

IF(
('Table1'[Type] IN {"a", "b", "c"} &amp;amp;&amp;amp; ' Table1'[Status] = "Completed" &amp;amp;&amp;amp; MONTH('Table1'[End]) = MONTH(TODAY()) - 1 &amp;amp;&amp;amp; YEAR(' Table1'[End]) = YEAR(TODAY()))
||
(' Table1'[Type] = "d" &amp;amp;&amp;amp; ' Table1'[Status] = "Completed" &amp;amp;&amp;amp; MONTH(' Table1'[Last Updated]) = MONTH(TODAY()) - 1 &amp;amp;&amp;amp; YEAR(' Table1'[Last Updated]) = YEAR(TODAY()))
||
(' Table1'[Type] IN {"a", "b", "c"} &amp;amp;&amp;amp; ' Table1'[Status] = "Completed" &amp;amp;&amp;amp; MONTH(' Table1'[End]) = MONTH(TODAY()) &amp;amp;&amp;amp; YEAR(' Table1'[End]) = YEAR(TODAY()))
||
(' Table1'[Type] = "d" &amp;amp;&amp;amp; ' Table1'[Status] = "Completed" &amp;amp;&amp;amp; MONTH(' Table1'[Last Updated]) = MONTH(TODAY())  &amp;amp;&amp;amp; YEAR(' Table1'[Last Updated]) = YEAR(TODAY())
),calculate (COUNTROWS(Table1), allexcept(Table1, Table1 [ID])),0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This acts as a simple flag to return 1, if a specific data criteria is met.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am i correct in thinking that the '_AvgCompleted' of 0.13 is probably counting the zeros and throwing off the&amp;nbsp;_5_star_rating?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 14:05:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279924#M169850</guid>
      <dc:creator>ClemFandango</dc:creator>
      <dc:date>2024-11-12T14:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279980#M169854</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="478905" data-lia-user-login="ClemFandango" class="lia-mention lia-mention-user"&gt;ClemFandango&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To increase variability, let's ensure the percentile ranking logic distributes values correctly by introducing a more granular approach. We’ll adjust by using the ranking and dividing it by the total count to create true percentiles, so each record falls into a more precise range for the 1-5 star ratings.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_5_star_rating = 
VAR _Completed = SUM(table1[Completed])
VAR Ranking = RANKX(ALL(table1), CALCULATE(SUM(table1[Completed])), , DESC, DENSE)
VAR TotalCount = COUNTROWS(ALL(table1))
VAR PercentileRank = DIVIDE(Ranking, TotalCount + 1)  // +1 to adjust rank-to-percentile scaling

VAR _star = 
    SWITCH(
        TRUE(),
        PercentileRank &amp;lt;= 0.2, 5,  // Top 20% get 5 stars
        PercentileRank &amp;lt;= 0.4, 4,  // Next 20% get 4 stars
        PercentileRank &amp;lt;= 0.6, 3,  // Middle 20% get 3 stars
        PercentileRank &amp;lt;= 0.8, 2,  // Next 20% get 2 stars
        1                          // Bottom 20% get 1 star
    )
RETURN 
REPT(UNICHAR(11088), _star) // Unicode for a filled star
&lt;/LI-CODE&gt;
&lt;P&gt;The resulting output is as shown below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 14:28:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4279980#M169854</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-11-12T14:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4280360#M169869</link>
      <description>&lt;P&gt;Yes, you're absolutely correct. The `_AvgCompleted` measure is likely including the zeros in its calculation, which is why it's producing a very low average (0.13). To fix this, you should modify `_AvgCompleted` to only average non-zero entries in the `Completed` column, which will give you the actual average for entries that meet the "Completed" criteria.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Updated `_AvgCompleted` Calculation&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can adjust `_AvgCompleted` to ignore zeros by using the `FILTER` function to only consider rows where `Completed` is 1. Here’s the revised measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAX&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_AvgCompleted = AVERAGEX(FILTER(ALL('table1'), 'table1'[Completed] = 1), 'table1'[Completed])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This change will calculate the average for only the rows where `Completed` equals 1, which should correct the `_5_star_rating` calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Revised `_5_star_rating` Measure&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now that `_AvgCompleted` accurately represents only the completed tasks, your `_5_star_rating` calculation should work as expected:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DAX&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_5_star_rating =
VAR _AvgCompleted = AVERAGEX(FILTER(ALL('table1'), 'table1'[Completed] = 1), 'table1'[Completed])
VAR _Completed = SUM('table1'[Completed])
VAR _RatingScale = DIVIDE(_Completed, _AvgCompleted)
VAR _star = INT(MIN(5, ROUNDUP(_RatingScale, 0))) // Limit rating to a max of 5 stars
RETURN
REPT(UNICHAR(11088), _star) // Unicode for a filled star&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Explanation&lt;/STRONG&gt;&lt;BR /&gt;1.&lt;STRONG&gt; _AvgCompleted:&lt;/STRONG&gt; Averages only the rows where `Completed = 1`.&lt;BR /&gt;2. &lt;STRONG&gt;_Completed:&lt;/STRONG&gt; Sums the completed tasks for each person.&lt;BR /&gt;3. &lt;STRONG&gt;_RatingScale&lt;/STRONG&gt;: Divides the individual’s completed tasks by the adjusted average.&lt;BR /&gt;4.&lt;STRONG&gt; _star:&lt;/STRONG&gt; Rounds up the rating scale, capping it at a maximum of 5 stars.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this adjustment, `_5_star_rating` should now accurately reflect the intended star rating based on the average completion of non-zero entries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Please mark this as solution if it helps you. Appreciate Kudos.&lt;/STRONG&gt;&lt;/EM&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 18:17:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4280360#M169869</guid>
      <dc:creator>FarhanJeelani</dc:creator>
      <dc:date>2024-11-12T18:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4283365#M170004</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="833383" data-lia-user-login="FarhanJeelani" class="lia-mention lia-mention-user"&gt;FarhanJeelani&lt;/a&gt;&amp;nbsp; again!&lt;/P&gt;&lt;P&gt;Your suggestions and guidance are really helping me to understand this. Unfortunatley, I am unable to get this working (it returns 5 stars for all 'persons') as i still have a couple of blindspots in my understanding.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think my dataset is causing the issues and I will try to outline the problems below.&lt;/P&gt;&lt;P&gt;This is the measure that I am using:-&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_5_star_rating = 
VAR _Completed = SUM(table1[Completed])
VAR Ranking = RANKX(ALL(table1), CALCULATE(SUM(table1[Completed])), , DESC, DENSE)
VAR TotalCount = COUNTROWS(ALL(table1))
VAR PercentileRank = DIVIDE(Ranking, TotalCount + 1)  // +1 to adjust rank-to-percentile scaling

VAR _star = 
    SWITCH(
        TRUE(),
        PercentileRank &amp;lt;= 0.2, 5,  // Top 20% get 5 stars
        PercentileRank &amp;lt;= 0.4, 4,  // Next 20% get 4 stars
        PercentileRank &amp;lt;= 0.6, 3,  // Middle 20% get 3 stars
        PercentileRank &amp;lt;= 0.8, 2,  // Next 20% get 2 stars
        1                          // Bottom 20% get 1 star
    )
RETURN 
REPT(UNICHAR(11088), _star) // Unicode for a filled star&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a breakdown of the results returned inside the measure:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;VAR _Completed&lt;/STRONG&gt; = this is correctly calculating the sum of the ammount of rows 'completed' by 'person'&lt;BR /&gt;&lt;STRONG&gt;VAR Ranking&lt;/STRONG&gt; = this returns a 1 for any 'person' that has a sum 'completed' &amp;gt;=1. Where a 'person' has 0 'completed' it returns 2. I am not sure if the number of the results returned by 'table1' is causing issues. A breakdown of the measure is = RANKX(ALL(table1) '&lt;STRONG&gt;this = 93482&lt;/STRONG&gt;', CALCULATE(SUM(table1[Completed])) '&lt;STRONG&gt;this = 1263 for the whole table and max of 326 by person&lt;/STRONG&gt;', , DESC, DENSE)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;VAR TotalCount&lt;/STRONG&gt; = This returns 93,482&lt;BR /&gt;&lt;STRONG&gt;VAR PercentileRank&lt;/STRONG&gt; = this returns 0.00001066 for any 'person' that has a sum 'completed' &amp;gt;=1. Where a 'person' has 0 'completed' it returns 0.00002131&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Am i correct in thinking that it is not working because my '&lt;STRONG&gt;totalcount&lt;/STRONG&gt;' is too large? Is there any way around this without reducing '&lt;STRONG&gt;totalcount&lt;/STRONG&gt;' in the dataset?&lt;/P&gt;&lt;P&gt;Another thing worth mentioning is that the maximum &lt;STRONG&gt;VAR _Completed&lt;/STRONG&gt; for any '&lt;STRONG&gt;person&lt;/STRONG&gt;' is about 326 and my dataset includes 30 'persons'. The total '&lt;STRONG&gt;completed&lt;/STRONG&gt;' for the whole table is 1263.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anything that can be done to get this working in my unweildy dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yours forever indebted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 07:39:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4283365#M170004</guid>
      <dc:creator>ClemFandango</dc:creator>
      <dc:date>2024-11-14T07:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4283946#M170027</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="478905" data-lia-user-login="ClemFandango" class="lia-mention lia-mention-user"&gt;ClemFandango&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Given the large dataset size, your PercentileRank is indeed returning very small values, which is why everyone seems to fall into the top star rating (5 stars). Let's address this by ranking each person only relative to the other persons instead of all 93,482 records.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here’s a refined approach:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;Calculate Ranking by Person: We’ll rank based on total “Completed” per person.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Calculate Total Person Count: Instead of counting all rows, we’ll count the unique persons.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Calculate Percentile Rank by Person Count: This will give a more realistic percentile range.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;Try this adjusted measure:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_5_star_rating = 
VAR _Completed = SUM(table1[Completed])
VAR TotalPersons = COUNTROWS(SUMMARIZE(ALL(table1), table1[Person]))
VAR PersonRanking = RANKX(
    ALL(table1[Person]), 
    CALCULATE(SUM(table1[Completed])), 
    , 
    DESC, 
    DENSE
)
VAR PercentileRank = DIVIDE(PersonRanking, TotalPersons + 1)  // Rank to percentile

VAR _star = 
    SWITCH(
        TRUE(),
        PercentileRank &amp;lt;= 0.2, 5,  // Top 20% get 5 stars
        PercentileRank &amp;lt;= 0.4, 4,  // Next 20% get 4 stars
        PercentileRank &amp;lt;= 0.6, 3,  // Middle 20% get 3 stars
        PercentileRank &amp;lt;= 0.8, 2,  // Next 20% get 2 stars
        1                          // Bottom 20% get 1 star
    )
RETURN 
REPT(UNICHAR(11088), _star) // Unicode for a filled star
&lt;/LI-CODE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;TotalPersons: Calculates the unique count of persons rather than the total rows.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;PersonRanking: Ranks each person based on their total "Completed" count, which should be a value from 1 to 30.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;PercentileRank: Divides the ranking by the total person count, which will give meaningful percentiles for the star rating.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;This revised measure should result in a more accurate distribution of stars across persons. Let me know how this works with your dataset!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 12:01:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4283946#M170027</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-11-14T12:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4285683#M170109</link>
      <description>&lt;P&gt;Hellooooo&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at this with fresh eyes after the wk/end I was able to solve it using your methodology, with the code below:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_5_star_rating = 
VAR _Completed = SUM(Table1[Completed])
VAR TotalPersons = COUNTROWS(SUMMARIZE(ALL(Table1), Activities[Person]))
VAR PersonRanking = RANKX(ALL(TeamCurrent[person]),
        CALCULATE (sum(Table1[Completed]),
      REMOVEFILTERS (TeamCurrent[Role],TeamCurrent[Team] ),
        VALUES ( 'Accounts'[isYes])),,DESC,Dense
    )

VAR PercentileRank = DIVIDE(PersonRanking, TotalPersons + 1)  // Rank to percentile

VAR _star = 
    SWITCH(
        TRUE(),
        PercentileRank &amp;lt;= 0.2, 5,  // Top 20% get 5 stars
        PercentileRank &amp;lt;= 0.4, 4,  // Next 20% get 4 stars
        PercentileRank &amp;lt;= 0.6, 3,  // Middle 20% get 3 stars
        PercentileRank &amp;lt;= 0.8, 2,  // Next 20% get 2 stars
        1                          // Bottom 20% get 1 star
    )
RETURN 
REPT(UNICHAR(11088), _star) // Unicode for a filled star&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only bit I am struggling with is the Var&lt;STRONG&gt; PersonRanking&lt;/STRONG&gt;. It currently ranks all of the '&lt;STRONG&gt;persons&lt;/STRONG&gt;' from 1 to 37 (with rank 1 having the most '&lt;STRONG&gt;Completed&lt;/STRONG&gt;', rank 36 has 1&amp;nbsp;'&lt;STRONG&gt;Completed&lt;/STRONG&gt;' &amp;nbsp;and rank 37 has 0 '&lt;STRONG&gt;Completed&lt;/STRONG&gt;'). The problem is that I have 6 'persons' that have a ranking of 37 (as they have 0 '&lt;STRONG&gt;Completed&lt;/STRONG&gt;'), and this distorts the PercentileRank slightly.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is there a way to ignore 'persons' in the ranking that have 0 'completed'?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many many thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 13:44:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4285683#M170109</guid>
      <dc:creator>ClemFandango</dc:creator>
      <dc:date>2024-11-18T13:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a ranking score between 1 &amp; 5</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4292966#M170360</link>
      <description>&lt;P&gt;Hi,&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="478905" data-lia-user-login="ClemFandango" class="lia-mention lia-mention-user"&gt;ClemFandango&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Has the problem been solved? If it does, share your solution and accept it as a solution that will help other community members who have the same problem as you.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;As we are unclear about the structure of your data, we are currently unable to make a complete inference or test based on the DAX you provided. If you require our assistance, I recommend that you provide the data structures for your tables: Table1, TeamCurrent, Activities, and Accounts, as well as the relationships between these tables. This will enable us to analyse your issue using virtual test data and assist you more effectively.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When uploading a file, please be careful to delete sensitive information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For questions about uploading data, you can try the following links:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-upload-PBI-in-Community/m-p/1672886" target="_blank"&gt;Solved: How to upload PBI in Community - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally, regarding your current issue, you might also consider adapting the filters directly to resolve it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;For further details, please refer to:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-report-add-filter?tabs=powerbi-desktop" target="_blank"&gt;Add a filter to a report in Power BI - Power BI | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Leroy Lu&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 09:28:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-ranking-score-between-1-amp-5/m-p/4292966#M170360</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-20T09:28:25Z</dc:date>
    </item>
  </channel>
</rss>

