cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

I want to convert decimal digits to percentage in a column that has multiple data types in Power BI.

I want to convert decimal digits to percentage in a column that has multiple data types in Power BI. How do I achieve this using query/measure in Power BI?  

Note: I want all the values in a single column as expected in output example is that possible to create?

 

Input data: Data type of the column: Any

Ayush_tiwari08_0-1676387951391.png

OUTPUT I AM EXPECTING 

Ayush_tiwari08_1-1676387998968.png

 

3 REPLIES 3
Ahmedx
Solution Sage
Solution Sage

Ahmedx
Solution Sage
Solution Sage

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WMlCK1YlWMgKTJmDSL1/BsaAgJzM5MSknFYeIgY6xqTmUZWBgaQETNDE1U4qNBQA=", 
          BinaryEncoding.Base64
        ), 
        Compression.Deflate
      )
    ), 
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [Column1 = _t]
  ), 
  typCh = Table.TransformColumnTypes(Source, {{"Column1", type text}}), 
  Fx = (x) =>
    if Text.Contains(x, "0,") then
      Text.From(Value.Add((Number.FromText(x) * 100), 0, Precision.Decimal)) & " %"
    else
      x, 
  Result = Table.TransformColumns(typCh, {"Column1", Fx})
in
  Result


Sample PBIX file attached
https://dropmefiles.com/3LCjD

Hi the file link which you have shared is not working.

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors