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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Super User
Super User

Ahmedx
Super User
Super User

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.