REPT functions is a Power BI text function in DAX which repeats text a given number of times.
is the text that you want to repeat.
is a number which specifying the number of times to repeat text, it must be positive number.
Lets look at an example of using REPT function in Power BI.
Here we have a sample data of customer feedback, you can see customers have given a ratings out of 5.
Now we will see the use of REPT function.
Lets use a REPT function to repeat a text any specified number of times.
Let’s create a new column named RepeatText that uses the REPT function which repeats text Hello up to 5 times.
RepeatText = REPT("Hello", 5)
Once you commit the DAX, lets drag it into card visual to see the output.
Lets see one more example, assume that you have to create a simple basic report which shows the ratings given by customers in terms of visual (emojis) such as if any customer has given 1 rating out of 5 then display one smiley emoji and remaining 4 will be shown as sad emoji.
Lets create a new column named Rept_Rating as shown below.
Rept_Rating = REPT ( UNICHAR ( 128513 ), CustomerFeeback[Ratings] ) & REPT ( UNICHAR ( 128530 ), 5 - CustomerFeeback[Ratings] )
Once you commit DAX, just drag it into visual to see the output.
You can see, REPT function repeats a Unicode number at specified number of time where number is a ratings given by customers.
To displaying emojis a UNICHAR function is used which returns Unicode character referenced by the numeric value.
Unicode number 128513 displays a smiley emoji character and Unicode number 128530 displays a sad emoji character.
You can also use another Unicode character to make your visual look more interactive, You can get various Unicode character symbol from website – URL
1,319 total views, 1 views today