cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndrejBI
Helper V
Helper V

Adjust the star rating with halves

Hi there,

 

I created this measure for stars: 

Star Rating = 
IF(HASONEVALUE(Forms[Rating]),  BLANK(),
LEFT(REPT(UNICHAR(9733), AVERAGE(Forms[Rating]))  
&  
REPT(UNICHAR(9734), 5-AVERAGE(Forms[Rating])),5))

Yet I need to make the visual more granulated, so it shows half stars as well or anything along the lines. Do you have any idea how to achieve this? I am also open to other solutions, maybe some icons? 

AndrejBI_0-1613552457982.png

 

 

1 ACCEPTED SOLUTION
cookieking
New Member

 

I have been playing around with this for a day or so. I have found that the unichar support for 11 is not available in power bi yet, for half stars. I created single star images and tried the REPT function, but that also failed. I guess that once it is set as an Image URL, the REPT function converts it back to a string. Then I created about 15 images for all 5 stars ratings that range from 1, 1.25, 1.5 through to 5. I converted the images to base64. I added this data to a table in my report. In addition, I named the images according to their rating value. With this, I was able to create a measure with a LOOKUP and get the correct star rating based on the average rating value:

 

 

 

 

Star = 
var decRAR = MROUND(AVERAGE('Ratings'[Rating]),0.25)
return
LOOKUPVALUE('FiveStar'[img],'FiveStar'[imgName],decRAR)

 

 

 

 

 

this works great, except for my image size. The actual size is 371 X 65, which seems large, but they are too small to read when added to a table. The only size setting I could find in the table was under GRID, Image Height. when I increase the height, the row height also increases, and the formatting does not look good. What is the best way to size these images?

View solution in original post

4 REPLIES 4
cookieking
New Member

 

I have been playing around with this for a day or so. I have found that the unichar support for 11 is not available in power bi yet, for half stars. I created single star images and tried the REPT function, but that also failed. I guess that once it is set as an Image URL, the REPT function converts it back to a string. Then I created about 15 images for all 5 stars ratings that range from 1, 1.25, 1.5 through to 5. I converted the images to base64. I added this data to a table in my report. In addition, I named the images according to their rating value. With this, I was able to create a measure with a LOOKUP and get the correct star rating based on the average rating value:

 

 

 

 

Star = 
var decRAR = MROUND(AVERAGE('Ratings'[Rating]),0.25)
return
LOOKUPVALUE('FiveStar'[img],'FiveStar'[imgName],decRAR)

 

 

 

 

 

this works great, except for my image size. The actual size is 371 X 65, which seems large, but they are too small to read when added to a table. The only size setting I could find in the table was under GRID, Image Height. when I increase the height, the row height also increases, and the formatting does not look good. What is the best way to size these images?

View solution in original post

v-yangliu-msft
Community Support
Community Support

Hi  @AndrejBI  ,

You can try to select Get more visuals in Visualizations to enter the custom visual object store

v-yangliu-msft_0-1613695080227.jpeg

2. Search for Stars and find Ratings View by TME AG.

v-yangliu-msft_1-1613695080232.png

3. This graphic can display more accurate Stars and interact with other views.

v-yangliu-msft_2-1613695080233.jpeg

You can downloaded PBIX file from here.

 

For related information about Star Rating, you can check the following link:

https://www.youtube.com/watch?v=T5IKZSlFSNc

 

Best Regards,

Liu Yang

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

amitchandak
Super User IV
Super User IV

Hi @amitchandak, yes I was inspired by these articles to create my measure. My question is about half to make it more granular, as it's a huge difference to have a 5-star rating for 4.9 and 4.51. I know there is a unicode for half a star but I can't get nor find the logic to make it work. 

 

Also, both of the articles are from 2018, so I was hoping for some updated version for this solution 🙂 

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Kudoed Authors