Monday, July 19, 2021

Power BI - How to create 5 STAR Rating in Power BI

 

1)   What is 5 STAR Rating

Customer review(s) help us in building our brand and also helps customer to choose which service/brand they should use. Five STAR Rating (★★★★★) is very simple & easy way to understand quality of service or brand value. It plays a very vital role in business.

 

2)   REPT & UNICHAR DAX function(s) in Power BI

We are going to use UNICHAR & REPT functions to implement Five STAR Rating:

a.      UNICHAR

                                                  i.      UNICHAR function returns the Unicode character referenced by the numeric value.

                                                ii.      Syntax – UNICHAR(number)

                                              iii.      The character represented by the Unicode number 9733 is ( character).

                                               iv.      The character represented by the Unicode number 9734 is (character).

                                                 v.      UNICHAR(9733) returns

                                               vi.      UNICHAR(9734) returns

b.      REPT

                                                  i.      REPT function repeats text a given number of times

                                                 ii.      Syntax - REPT(<text>, <num_times>)

                                               iii.       REPT("A",3)  returns AAA


 3)   How it works in Power BI

a.      Open the Power BI Designer

b.      Create a table e.g StarRating with values 1-5 in column named Rate.

 

                                           
 

c.       Create a calculated Measure using UNICHAR & REPT to generate the 5 STAR Rating (★★★★★)

d.      Expression:
REPT(UNICHAR(9733), AVERAGE('StarRating'[Rank]))  &&

REPT(UNICHAR(9734), 5 - AVERAGE('StarRating'[Rank]))

 

                   

 

4)   Understanding of DAX Expression(s) & 5 STAR Rating

 


5)   Conclusion: We are able to generate 5 START Rating in Power BI

1 comment: