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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.