skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Security
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Microsoft 365 + Power BI
    • Dynamics 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Media
      • Retail
    • For analysts
    • For IT
      • Overview
      • Embedded analytics
      • Power BI visuals
      • Automation
      • Documentation
      • Community
    • Getting started
      • Overview
      • Self-guided learning
      • Webinars
      • Documentation
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Business intelligence topics
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Microsoft Power BI Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power BI
    • Desktop
    • Service
    • Report Server
    • Power Query
    • Mobile Apps
    • Developer
    • DAX Commands and Tips
    • Custom Visuals Development Discussion
    • Health and Life Sciences
    • Power BI Spanish Community
    • Translated Spanish Desktop
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Training and Consulting
    • Instructor Led Training
    • Galleries
    • Community Connections & How-To Videos
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Events
    • Ideas
    • Custom Visuals Ideas
    • Issues
    • Issues
    • Events
    • Upcoming Events
    • Community Engagement
    • T-Shirt Design Challenge 2023
    • Community Blog
    • Power BI Community Blog
    • Custom Visuals Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power BI Community
    • Galleries
    • Quick Measures Gallery
    • Re: Star Ratings

    Re: Star Ratings

    01-06-2022 08:03 AM

    GhaziSalahuddin
    Regular Visitor
    19476 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    cwebb
    cwebb Advocate V
    Advocate V
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Star Ratings

    ‎04-30-2017 02:19 AM

    This quick measure displays a score or rating out of five as a series of filled and unfilled stars. In the example in the report, there is a table called restaurants and a numeric column on that table called Score that contains a rating out of five. This measure takes the value in the Score column and displays the same number of filled stars (using the DAX Unichar() function) followed by whatever number of unfilled stars are needed to make the total number of stars up to five.

     

    DAX:

     

    Stars =

    REPT(UNICHAR(9733), AVERAGE('Restaurants'[Score]))

    &

    REPT(UNICHAR(9734), 5-AVERAGE('Restaurants'[Score]))

     

    For more details and other examples of how you can use this technique, see my blog post on the subject at:

    https://blog.crossjoin.co.uk/2017/04/11/the-dax-unichar-function-and-how-to-use-it-in-measures-for-d...

    eyJrIjoiYzYzZmFkMDEtZmFhZi00MzJlLWE2NGEtZGE3ZjFiOTRiYzRmIiwidCI6ImEyODQ0OTIzLTEyMTgtNGQzNi1hN2M1LTk1ODJhMzhhNGU1ZCIsImMiOjh9

    Preview file
    14 KB
    StarsQuickMeasure.pbix
    Labels:
    • Labels:
    • Other
    Message 1 of 18
    72,247 Views
    25
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    levialae
    levialae
    Frequent Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-07-2021 07:02 AM

    @cwebb Hi Chris

     

    Thanks for the tool!

    I have a question: Is it possible to change the formula so that you get a lower star-ranking the higher the value you score. I.e. number of defects should be as low as possible and generate more stars instead of fewer.

    Message 18 of 18
    25,648 Views
    0
    Reply
    bideveloper555
    bideveloper555 Helper IV
    Helper IV
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-03-2021 09:02 AM

    hi

    This is working great but using slicer it doesnt work.

    i am trying to slice based on some user names but rating doesnt work.

     i am slicing on column"Name" 

     

    Any help please.

    Stars =

    REPT(UNICHAR(9733), CALCULATE(AVERAGE('PowerBI vwtable'[starcolumn]),ALLEXCEPT('usertable',usertable[Name])))

    &

    REPT(UNICHAR(9734), CALCULATE(5-AVERAGE('PowerBI vwtable'[starcolumn]),ALLEXCEPT('usertable',usertable[Name])))
     
     
    Many thanks in Advance
    Message 17 of 18
    27,201 Views
    0
    Reply
    skorpionaa
    skorpionaa Helper I
    Helper I
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎03-23-2020 05:04 PM

    can we chnage the Colours of stars ?

    Message 13 of 18
    36,197 Views
    0
    Reply
    GhaziSalahuddin
    GhaziSalahuddin
    Regular Visitor
    In response to skorpionaa
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎01-06-2022 08:00 AM

    Hi @skorpionaa 

     

    Yes, you can change the color. Below are the steps:

    1 - Click on the format menu.

    2 - Click on the Field Formatting option.

    3 - From the dropdown, select the rating option (or maybe the one which you have chosen while creating the rating measure).

    4 - Click on Font color and choose your favorite color.

     

    Happy Learning!

    Preview file
    29 KB
    Message 16 of 18
    19,482 Views
    0
    Reply
    justindoh
    justindoh
    Frequent Visitor
    In response to skorpionaa
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-12-2021 10:14 AM

    @skorpionaa 

     

    Were you able to find a solution (colored star)?

     

    Thanks.

    Message 14 of 18
    32,070 Views
    0
    Reply
    GhaziSalahuddin
    GhaziSalahuddin
    Regular Visitor
    In response to justindoh
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎01-06-2022 08:03 AM

    Hi @justindoh 

     

    Yes, you can change the color. Below are the steps:

    1 - Click on the format menu.

    2 - Click on the Field Formatting option.

    3 - From the dropdown, select the rating option (or maybe the one which you have chosen while creating the rating measure).

    4 - Click on Font color and choose your favorite color.

     

    Happy Learning!

    Preview file
    29 KB
    Message 15 of 18
    19,476 Views
    0
    Reply
    Anonymous
    Not applicable
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎03-15-2019 11:00 PM

    Check out this short Youtube video as well on how to create quick measure:

    Youtube video: Power BI Quick Measures

    Message 12 of 18
    36,610 Views
    0
    Reply
    Anonymous
    Not applicable
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-25-2017 06:18 AM

    Hi chris, if the avg rating is 4.5 or 3.5 will it show half filled stars? or how can we do it.

    Message 8 of 18
    71,133 Views
    1
    Reply
    cwebb
    cwebb Advocate V
    Advocate V
    In response to Anonymous
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-25-2017 11:44 AM

    As far as I can see there's isn't a unicode character for a half-filled star, so it would not be possible to use this technique to display half-filled stars.

     

    Sorry!

     

    Chris

    Message 9 of 18
    71,130 Views
    1
    Reply
    dcresp
    dcresp Advocate IV
    Advocate IV
    In response to cwebb
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎06-24-2019 06:55 AM

    @cwebb 

     

    This seems to provide a half star. Is it possible to use this for a half star rating? https://www.fileformat.info/info/unicode/char/2bea/index.htm

    Message 11 of 18
    36,514 Views
    0
    Reply
    safadig
    safadig
    Regular Visitor
    In response to cwebb
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-03-2018 03:53 AM

    A solution would be to:

     

    1. Create an image for each star rating you liked displayed ( including half ratings).

    2. Upload image to a URL.

    3. Create calculated column in data based on rating.

    4. Add Column by example that include Properly named image URL column to reflect your rating image.

    5. Change Poperties of URL Column under Modeling to image url.

    6. Use you new URL image column in the table to show the ratings

    Message 10 of 18
    68,168 Views
    1
    Reply
    mdaamirkhan
    mdaamirkhan Post Prodigy
    Post Prodigy
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-17-2017 12:20 AM

    Hello Everyone,

     

    I have created quick measure "Star Rating" based on sales value but I dont the Value for highest star rating. Sales value either be Million or Billion or less.

     

    How I want to set MAX_RATED_VALUE dynamic based on sales? Can you please help me on this ?

     

    Sales_LCD star rating =
    VAR __MAX_NUMBER_OF_STARS = 5
    VAR __MIN_RATED_VALUE = 0
    VAR __MAX_RATED_VALUE = 1000000
    VAR __BASE_VALUE = SUM('Pfizer Champix QTR'[Sales_LCD])
    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)
    RETURN
    IF(
    NOT ISBLANK(__BASE_VALUE),
    REPT(UNICHAR(9733), __STAR_RATING)
    & REPT(UNICHAR(9734), __MAX_NUMBER_OF_STARS - __STAR_RATING)
    )

     

    Message 2 of 18
    71,286 Views
    0
    Reply
    cwebb
    cwebb Advocate V
    Advocate V
    In response to mdaamirkhan
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-21-2017 02:56 AM

    You need to create another measure in your report that returns the max value, and then replace the hardcoded max value (1000000 in your example) with the name of the measure.

     

    So, for example, if you created a measure called [Max Sales] that returned the maximum sales visible on your report (this might be quite difficult to do though...) then the highlighted line would be:

     

    VAR __MAX_RATED_VALUE = [Max Sales]

     

     

    Regards,

     

    Chris

    Message 3 of 18
    71,196 Views
    0
    Reply
    mdaamirkhan
    mdaamirkhan Post Prodigy
    Post Prodigy
    In response to cwebb
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-21-2017 03:23 AM

    I have a measure called [Max Sales]  

    Query is ok or not

     

    MaxSales = MAX('Pfizer Champix QTR'[Sales_LCD])

    Message 4 of 18
    71,193 Views
    0
    Reply
    mdaamirkhan
    mdaamirkhan Post Prodigy
    Post Prodigy
    In response to mdaamirkhan
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-23-2017 07:09 AM

    I already tried that its showing 5-stars in all sales but where sales vlue is 0 it showing not stars.

    Message 5 of 18
    71,172 Views
    0
    Reply
    cwebb
    cwebb Advocate V
    Advocate V
    In response to mdaamirkhan
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-24-2017 05:43 AM

    The expression MAX('Pfizer Champix QTR'[Sales_LCD]) will give you the maximum value found in a row in the 'Pfizer Champix QTR' table in your data model, which is not necessarily the maximum value displayed in your visualisation. If you add it to your table as a separate column, does it give you the values you expect? My guess is that you'll need to use the MAXX() function in a more complex measure, and not the MAX() function here:

     

    https://msdn.microsoft.com/en-us/library/ee634576.aspx

     

    Chris

    Message 6 of 18
    71,158 Views
    0
    Reply
    mdaamirkhan
    mdaamirkhan Post Prodigy
    Post Prodigy
    In response to cwebb
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-24-2017 08:43 AM

    i found that solution and thanks for helping me

    Message 7 of 18
    71,152 Views
    0
    Reply

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    © 2023 Microsoft

    Follow Power BI

    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    Consumer Privacy Act (CCPA) Opt-Out Icon Your Privacy Choices