Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
31 | |
31 | |
20 | |
15 | |
12 |
User | Count |
---|---|
21 | |
20 | |
16 | |
10 | |
9 |