Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello all,
I would like have a custom function able to change column type to percentage only if the column header has "%" inside.
I know the function to use is Table.TransformColumnTypes. I made this:
Changed_Type1 = Table.TransformColumnTypes(
Table_to_Change,
{{ List.Select (Table.ColumnNames (Table_to_Change), each Text.Contains (_, "%"),
Percentage.Type}})
The point is that List.Select (Table.ColumnNames (Table_to_Change), each Text.Contains (_, "%") return a list, while there I need to have text.
How to do this?
Thanks.
Solved! Go to Solution.
Changed_Type1 = Table.TransformColumnTypes(
Table_to_Change,
List.Transform(List.Select(Table.ColumnNames(Table_to_Change), each Text.Contains(_, "%")), each {_, Percentage.Type})
)
Changed_Type1 = Table.TransformColumnTypes(
Table_to_Change,
List.Transform(List.Select(Table.ColumnNames(Table_to_Change), each Text.Contains(_, "%")), each {_, Percentage.Type})
)
Thanks AlienSx
User | Count |
---|---|
19 | |
10 | |
10 | |
9 | |
7 |
User | Count |
---|---|
23 | |
19 | |
16 | |
13 | |
11 |