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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
stiani
Frequent Visitor

Data Cleanup - Datatype any to number

Ive got a column "belop" where i try to remove "spaces" and make the column type number. But as you can se only numbers up to 999 will register as "number". The other as text.

 

Ive tried to make a function "remove spaces" 

 

= (InputText as any) =>
let
Cleandata = Text.Combine(
List.Select(
Text.Split(
Text.Trim( InputText ), " "),
each _ <> ""
),
" "
)
in
Cleandata

 

This did not work. Ive also tried replace value " " with "" in transform. 

 

stiani_0-1725963773737.png

 

Ive also tried to just change data type to "whole number" or "fixed desimal number" then the output is this:

 

stiani_1-1725964144075.png

 

And the error message is this 

stiani_2-1725964168209.png

 

Ive also tried replace value  "," with ".".

 

 

How do i  transform column belop to numbers?  

 

 

1 ACCEPTED SOLUTION
v-jtian-msft
Community Support
Community Support

Hi,dharmendars007 ,thanks for your concern about this issue.

Your answer is excellent!
And I would like to share some additional solutions below.
Hello,@stiani .I am glad to help you.
Based on your description, you have a text column that needs to be processed

vjtianmsft_0-1726038629141.png

Here is my test data(Text type with spaces)

vjtianmsft_1-1726038696729.png

The text here is formatted as a number plus space plus decimal point (I interpret the comma in the screenshot you provided as a decimal sign)
You need to convert it to a numeric type (signed decimal type)
If my understanding is correct, you can refer to my test below
1. Split the question column into multiple columns based on spaces

vjtianmsft_2-1726038729024.png

2. Select the multiple columns that have been split (after multiple selections), merge them into one column, and successfully remove the spaces.

vjtianmsft_6-1726039045695.png

 

vjtianmsft_3-1726038820414.png

3. Set the data type correctly to numeric (decimal)

vjtianmsft_4-1726038852626.png

4. Correctly format the data for the modified field in desktop (keep two decimal places)

vjtianmsft_5-1726038879042.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-jtian-msft
Community Support
Community Support

Hi,dharmendars007 ,thanks for your concern about this issue.

Your answer is excellent!
And I would like to share some additional solutions below.
Hello,@stiani .I am glad to help you.
Based on your description, you have a text column that needs to be processed

vjtianmsft_0-1726038629141.png

Here is my test data(Text type with spaces)

vjtianmsft_1-1726038696729.png

The text here is formatted as a number plus space plus decimal point (I interpret the comma in the screenshot you provided as a decimal sign)
You need to convert it to a numeric type (signed decimal type)
If my understanding is correct, you can refer to my test below
1. Split the question column into multiple columns based on spaces

vjtianmsft_2-1726038729024.png

2. Select the multiple columns that have been split (after multiple selections), merge them into one column, and successfully remove the spaces.

vjtianmsft_6-1726039045695.png

 

vjtianmsft_3-1726038820414.png

3. Set the data type correctly to numeric (decimal)

vjtianmsft_4-1726038852626.png

4. Correctly format the data for the modified field in desktop (keep two decimal places)

vjtianmsft_5-1726038879042.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That worked perfectly! Thank you!

stiani
Frequent Visitor

It did not work  as intended.

 

For values above 999 they addes 2 desimals at the end.

For values below 999  i am getting an error message for the values below.

 

stiani_0-1725969495729.png

 

 

stiani_1-1725969510298.png

 

 

dharmendars007
Solution Sage
Solution Sage

Hello @stiani , 

 

Please try creating custom column using the below formula..

 

Text.Select([Belop], {"0".."9", "-"})

 

If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors