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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have table with two columns in a table for with values as 0.31 and 0.12. I to show need 0.31 as 31% which mutiplied by 100. I need to change this only for StockB where it exists in the table. How to do it in Power any idea is welcome.
| Name | Value |
| StockB | 0.31 |
| StockC | 0.12 |
| StockD | 6.99 |
| StockE | 20.99 |
Output:
| Name | Value |
| StockB | 31% |
| StockC | 0.12 |
| StockD | 6.99 |
| StockE | 20.99 |
Hello - you can do it like this:
Table.AddColumn(#"Changed Type", "Custom", each if [Name] = "StockB" then [Value]*100 else [Value])
I need to do this query as new custom column? I tried but it is not working that way it showing as expand table.
How to do this multiple coulmns?
The example above is to add a new column with the expected result. If you want to replace the value in the existing column, you could do it like this:
Table.ReplaceValue(Custom1, each [Value],each if [Name] = "StockB" then [Value]*100 else [Value],Replacer.ReplaceValue,{"Value"})
Here is the complete script which includes both scenarios.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCi7JT852UtJRMtAzNlSK1YGKOINFDI0QIi5AETM9S0uEiCtQxMgALBQLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Value", type number}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [Name] = "StockB" then [Value]*100 else [Value]),
Custom1 = #"Added Custom",
#"Replaced Value" = Table.ReplaceValue(Custom1, each [Value],each if [Name] = "StockB" then [Value]*100 else [Value],Replacer.ReplaceValue,{"Value"})
in
#"Replaced Value"
If you will post a copy of your script I can try to identify why you would be getting the option to expand values. It is most likely something in your script.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |