Tran Nhung
Tran Nhung

Reputation: 3

Multiple data type column in Power Query

I have a column with multiple data type in Power BI as the following below. How I can convert/modify to Currency ( Fixed decimal number)

old_price

null 990 SR 4,040 SR 50/4 pack SR 445/2 pack null 895 SR 50/4 pack ......

I tried some of ways below

I would like to convert this mixed data into Fixed decimal number

Upvotes: 0

Views: 26

Answers (1)

Michal
Michal

Reputation: 6064

Having a mixed type column is generally a very bad idea. You could use something like that:

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],

    TransformColumn = Table.TransformColumns(
        Source,
        {
            {"Column1", each if Value.Is(_, type number) then Number.ToText(_, "C") else _}
        }
)
in
    TransformColumn

Number.ToText(_, "C") - is used to format string as currency.

Upvotes: 0

Related Questions