Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I need to create a column in Power Query where a text( is an unichar code) appears repeated n times (n is a number that will be in a column named the STARS), this number goes from 0 to 5. I try with Text.Repeat(CharacterFromNumber(), 5), when i hardcode the number of repetition works fine, my problem is that i dont know how to say to put the value of the column STARS.
Basically what i need is to translate this DAX formula to M:
UNICODE STARS=
REPT(UNICHAR(9733), AVERAGE(CLIENTS[STARS]))
&
REPT(UNICHAR(9734), 5-AVERAGE(CLIENTS[STARS]))
Solved! Go to Solution.
@Ion_Ander , you should able to get that with text.repeat for average refer
https://community.powerbi.com/t5/Power-Query/Average-using-M-Power-Query/td-p/853387
Finally found the solution, the problem was that List.Average expect a List so need to put the column name into {} to transform the column in a List
The formula:
Text.Repeat(Character.FromNumber(9733), List.Average({[ESTRELLAS]})) & Text.Repeat(Character.FromNumber(9734), 5-List.Average({[ESTRELLAS]}))
@Ion_Ander , you should able to get that with text.repeat for average refer
https://community.powerbi.com/t5/Power-Query/Average-using-M-Power-Query/td-p/853387
Finally found the solution, the problem was that List.Average expect a List so need to put the column name into {} to transform the column in a List
The formula:
Text.Repeat(Character.FromNumber(9733), List.Average({[ESTRELLAS]})) & Text.Repeat(Character.FromNumber(9734), 5-List.Average({[ESTRELLAS]}))
@Ion_Ander - You want Text.Repeat
Yes, i know, but how i put in the second argument(number of repetitions) the value of the STARS column?
@Ion_Ander Whoops, should have read closer. You will have to refer to your table step and use List.Average(Table.Column( ) )
I get an error that says something like: cant convert Table type value to Text type
Text.Repeat(Character.FromNumber(9734), List.Average(Table.Column(dbo_CLIENTS, STARS)))
User | Count |
---|---|
141 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
123 | |
101 | |
71 | |
61 |