Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
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
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 16 | |
| 12 | |
| 9 | |
| 7 | |
| 6 |