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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jeongkim
Post Prodigy
Post Prodigy

extract only number value in query

Hi,

Values is mixed up with number and text.

Need only number so output will be:

 

16571

10000

0

0

0

0

0

0

41429

0

 

jeongkim_0-1741075522476.png

 

1 ACCEPTED SOLUTION

Hello @jeongkim,

Thanks for your follow-up and clarification regarding the "金額" column.

Based on your updated query, you can modify your code to extract only the numeric values from the "金額" column like this:

let

    // Existing steps

    #"Renamed Columns2" = Table.RenameColumns(#"Expanded Work Order PDF - bottom", {

        {"Work Order PDF - top b.派工單號", "派工單號"},

        {"Work Order PDF - top b.PO NO", "PO NO"},

        {"Work Order PDF - middle.標的物編號", "標的物編號"},

        {"Work Order PDF - middle.標的物名稱", "標的物名稱"},

        {"Work Order PDF - middle.監工人員", "監工人員"},

        {"Work Order PDF - middle.備 註", "備 註"},

        {"Work Order PDF - bottom.派工工程項目", "派工工程項目"},

        {"Work Order PDF - bottom.4G or 5G", "4G or 5G"},

        {"Work Order PDF - bottom.安裝型態", "安裝型態"},

        {"Work Order PDF - bottom.金額", "金額"},

        {"Work Order PDF - bottom.數量", "數量"}

    }),

   

    #"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns2", {

        "Source Name", "通知日期", "派工目的", "派工單號", "PO NO",

        "標的物編號", "標的物名稱", "監工人員", "備 註", "派工工程項目",

        "4G or 5G", "安裝型態", "金額", "數量", "Date created"

    }),



    // New step: Remove non-numeric characters from 金額 column

    #"RemoveNonNumericFrom金額" = Table.TransformColumns(#"Reordered Columns", {

        {"金額", each Text.Select(Text.From(_), {"0".."9"}), type text}

    }),



    // New step: Convert cleaned 金額 column to number

    #"金額ToNumber" = Table.TransformColumnTypes(#"RemoveNonNumericFrom金額", {

        {"金額", Int64.Type}

    })

in

    #"金額ToNumber"

 

  • We first convert "金額" to text, then keep only digits using Text.Select.
  • Finally, we convert it back to a number type.

This ensures that if your "金額" column contains mixed text and numbers (e.g., "金額=NTD5000"), it will properly extract only the numbers (e.g., 5000).

 

If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

View solution in original post

7 REPLIES 7
v-ssriganesh
Community Support
Community Support

Hi @jeongkim,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

v-ssriganesh
Community Support
Community Support

Hi @jeongkim,

May I ask if you have resolved this issue? If so, please mark it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Anonymous
Not applicable

Hi, @jeongkim 

Thanks for the reply from bhanu_gautam. Try this in Power Query.

vyaningymsft_0-1741140665755.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKs4sSS3Wfdbd9nLmkvinPdN1Dc1MzQ2VYnWilQwNgADMwk+aGJoYWSLxLSH6YgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    RemoveNonNumeric = Table.TransformColumns(Source, {"Column1", each Text.Select(_, {"0".."9"}), type text}),
    ChangeType = Table.TransformColumnTypes(RemoveNonNumeric,{{"Column1", Int64.Type}})
in
    ChangeType

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi,

 

Can you re-write the code pls?

 

#"Renamed Columns2" = Table.RenameColumns(#"Expanded Work Order PDF - bottom",{{"Work Order PDF - top b.派工單號", "派工單號"}, {"Work Order PDF - top b.PO NO", "PO NO"}, {"Work Order PDF - middle.標的物編號", "標的物編號"}, {"Work Order PDF - middle.標的物名稱", "標的物名稱"}, {"Work Order PDF - middle.監工人員", "監工人員"}, {"Work Order PDF - middle.備 註", "備 註"}, {"Work Order PDF - bottom.派工工程項目", "派工工程項目"}, {"Work Order PDF - bottom.4G or 5G", "4G or 5G"}, {"Work Order PDF - bottom.安裝型態", "安裝型態"}, {"Work Order PDF - bottom.金額", "金額"}, {"Work Order PDF - bottom.數量", "數量"}}),
#"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns2",{"Source Name", "通知日期", "派工目的", "派工單號", "PO NO", "標的物編號", "標的物名稱", "監工人員", "備 註", "派工工程項目", "4G or 5G", "安裝型態", "金額", "數量", "Date created"})
in
#"Reordered Columns"

 

 

"金額" is the column related. 

Hello @jeongkim,

Thanks for your follow-up and clarification regarding the "金額" column.

Based on your updated query, you can modify your code to extract only the numeric values from the "金額" column like this:

let

    // Existing steps

    #"Renamed Columns2" = Table.RenameColumns(#"Expanded Work Order PDF - bottom", {

        {"Work Order PDF - top b.派工單號", "派工單號"},

        {"Work Order PDF - top b.PO NO", "PO NO"},

        {"Work Order PDF - middle.標的物編號", "標的物編號"},

        {"Work Order PDF - middle.標的物名稱", "標的物名稱"},

        {"Work Order PDF - middle.監工人員", "監工人員"},

        {"Work Order PDF - middle.備 註", "備 註"},

        {"Work Order PDF - bottom.派工工程項目", "派工工程項目"},

        {"Work Order PDF - bottom.4G or 5G", "4G or 5G"},

        {"Work Order PDF - bottom.安裝型態", "安裝型態"},

        {"Work Order PDF - bottom.金額", "金額"},

        {"Work Order PDF - bottom.數量", "數量"}

    }),

   

    #"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns2", {

        "Source Name", "通知日期", "派工目的", "派工單號", "PO NO",

        "標的物編號", "標的物名稱", "監工人員", "備 註", "派工工程項目",

        "4G or 5G", "安裝型態", "金額", "數量", "Date created"

    }),



    // New step: Remove non-numeric characters from 金額 column

    #"RemoveNonNumericFrom金額" = Table.TransformColumns(#"Reordered Columns", {

        {"金額", each Text.Select(Text.From(_), {"0".."9"}), type text}

    }),



    // New step: Convert cleaned 金額 column to number

    #"金額ToNumber" = Table.TransformColumnTypes(#"RemoveNonNumericFrom金額", {

        {"金額", Int64.Type}

    })

in

    #"金額ToNumber"

 

  • We first convert "金額" to text, then keep only digits using Text.Select.
  • Finally, we convert it back to a number type.

This ensures that if your "金額" column contains mixed text and numbers (e.g., "金額=NTD5000"), it will properly extract only the numbers (e.g., 5000).

 

If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

bhanu_gautam
Super User
Super User

@jeongkim Add a new custom column by going to the "Add Column" tab and selecting "Custom Column".
In the Custom Column formula box, enter the following formula to extract only the numeric values:

= try Number.FromText(Text.Select([YourColumnName], {"0".."9"})) otherwise 0
 
 



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi,

Code doesn't seem to correct,, should I put 'try' as well?
If I remove 'try' also not working. shoud I put all number one by one? 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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