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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.