Jake Carville on 07 Jan 2016 17:27:04
It would be brilliant to have a star rating visualization to show ratings on a set scale, possibly from 0-5, or even 10. It would be similar to the rating system on amazon, and would be a great way to display quality metrics.
- Comments (19)
RE: Star Rating Visualization
My data has the 1 - 5 score. I just need the star visualization of the values. How do I get the stars? (sorry for a beginner question)
RE: Star Rating Visualization
Why is this marked as completed? I don't see a star-rating viz anywhere.
RE: Star Rating Visualization
I have problems when I try to show this custom visual. The star doesn't update when there is no data.
RE: Star Rating Visualization
Can you please tell me how to download this visual.. Its not there in office store
RE: Star Rating Visualization
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)
)
RE: Star Rating Visualization
Jake
I was wondering if the code for this custom visual is available anywhere. I have been trying to source something similar to what you have created in Stars. Only problem is that instead of a maximum of 5, I would like to to be about 100. Really just a visual representation of an integer.
RE: Star Rating Visualization
What an excellent visual, exactly what I was looking for in terms of look, feel and functionality. A big thanks to Tim Sawyer for a brilliant visual and to Pedro Innecco for all his help.
Jake
RE: Star Rating Visualization
I am glad that I could help! :)
Basically Wikicommons have those stars available as images that you can download. And you can have it to automatically generate the thumbnails with the size that you want. Note the "100px" bit on the url. You can change to any size you want.
RE: Star Rating Visualization
Hi again Pedro,
I have to say that is a nice formula that you have put together that works beautifully to automate a Star Rating type chart, many thanks.
Originally I was importing an image manually but this is a lot more streamlined and a big step up so thank you.
I have found the Power BI community to be very creative and helpful.
Regards,
Jake
RE: Star Rating Visualization
'Hi Jake,
I had another thought about this and you could easily show the stars on a table by using a text field configured as "Image URL". This Image URL column would be a calculated column with a DAX formula to show the stars. The DAX formula would be a simple SWITCH statement to show the correct number of stars based on the rating.
Now it would be better if the rating is a static column coming from the underlying database which is already in the ratio you want to use for the stars. Or you could make a calculated column to change whatever scale you have for the rating in order to follow the star rating scale.
Check out the code below. I made it using the thumbnail of stars I got from Wikicommons. You could easily save those somewhere else if you want to. If you go to the Wikicommons site you can also generate the URL for any thumbnail size you want.
=SWITCH([RatingColumn],
0.5 , "https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/0.5_stars.svg/100px-0.5_stars.svg.png",
1 , "https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/0.5_stars.svg/100px-0.5_stars.svg.png",
1.5 , "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c6/1.5_stars.svg/100px-1.5_stars.svg.png",
2 , "https://upload.wikimedia.org/wikipedia/commons/thumb/8/88/2_stars.svg/100px-2_stars.svg.png",
2.5 , "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/2.5_stars.svg/100px-2.5_stars.svg.png",
3 , "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/3_stars.svg/100px-3_stars.svg.png",
3.5 , "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/3.5_stars.svg/100px-3.5_stars.svg.png",
4 , "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/4_stars.svg/100px-4_stars.svg.png",
4.5 , "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/4.5_stars.svg/100px-4.5_stars.svg.png",
5 , "https://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/5_stars.svg/100px-5_stars.svg.png",
"https://upload.wikimedi