Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
RajeshZZ424
Frequent Visitor

Power Bi Table

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.

NameValue
StockB0.31
StockC0.12
StockD6.99
StockE20.99

 

Output:

NameValue
StockB31%
StockC0.12
StockD6.99
StockE20.99

 

3 REPLIES 3
jennratten
Super User
Super User

Hello - you can do it like this:

Table.AddColumn(#"Changed Type", "Custom", each if [Name] = "StockB" then [Value]*100 else [Value])

jennratten_0-1680121324951.png

 

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.

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.