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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
padinator
Helper I
Helper I

Dynamic Datatype from Text to Number conversion is different Localization per Row

Hello there,i have a power query which is updating excel files placed within a specific folder.

The layout of these files is always identical - therefor i can easily set the appropriate steps neeed in order to format the document as needed.


My problem is, that there is a Value Column (Quantity) wihch seems to be differently formatted within the particular documents.

Sometimes it has a DOT (100.00) as separator and sometimes there is a comma (100,00) - example given for ONE HUNDRET.

 

Now i am wondering to somehow dynmically identify the format used and adapt it accordingly because at the moment as i set en-US as localization i get something like 10000000000 for 100,00 and if i set de-DE i get 1000000000 for 100.00 .

In addition to that i found out that sometimes a thousand-separator is used (e.g. 1.000,00) or (e.g.

For any further questions please let me know! Any help is highly appreciated ! !

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

assume all the values in this column is integer, then try this code

NewStep=Table.TransformColumns(PreviousStepName,{"Quantity",each let a=Text.SplitAny(_,".,") in Number.From(Text.Combine(a))/(if Text.Length(List.Last(a))=2 then 100 else 1)})

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @padinator ,

 

Any updates? Does @wdx223_Daniel 's method help you?

Please Accept a helpful reply as the solution to make this thread closed. Other members could find it more quickly.

 


Best Regards,
Eyelyn Qin

wdx223_Daniel
Super User
Super User

assume all the values in this column is integer, then try this code

NewStep=Table.TransformColumns(PreviousStepName,{"Quantity",each let a=Text.SplitAny(_,".,") in Number.From(Text.Combine(a))/(if Text.Length(List.Last(a))=2 then 100 else 1)})

smpa01
Super User
Super User

@padinator  can you please provide a sample data representative of the issue of that single column which has mixed decimal/hundred seperator? ALso, please provide the desired output of that sample data? 

I had a somewhat similar situation and I solved it. But I will wait till you provide the data.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Hei and thanks for your message - for me as i mentioned, it seems that it resolved the issue by itself. The problem i have is that we have localization with "," separator for decimals and "." for thousands which would look something like this (e.g. 1.240,00) now as i use the raw data the amount columns are formatted as text but mainly look like the example above - nonetheless the system is formatting the numbers like 1240.00 when they are being imported. What i did is to first set the type to "any" instead of text for this columns when importing and then i specified localization en-US as i finally changed the datatype to number.

 

padinator_0-1639057215963.png

 

I am using this command to handle the datatype conversion correctly

= Table.TransformColumnTypes(#"Umbenannte Spalten",{{"Kosten Einlagerung", type number}, {"Kosten Lager", type number}, {" Kost. Pal.", Int64.Type}, {" Pickkosten", Int64.Type}, {" Cont. Kost.", Int64.Type}, {"Kosten Admin", type number}, {" Kosten Fracht", type number}},"en-US")

 

Afterwards it looks like this

padinator_1-1639057384553.png

 

i really do not understand how and why the system is automatically converting the amount (as text formatted) columns from e.g. 6,9 to 6.9 when importing and then as i would change the datatype to Int64 i would get a huge number without the en-US at the end. Strange enough it does it only for certain sheets

 

 

ronrsnfld
Super User
Super User

Is there no way that you can obtain the files with that column as a number rather than as text?  If not, you'll have to create a custom column that somehow analyzes the various possible combinations of delimiters and determines which translation to use.  But I don't know how to take a column with, let us say, three decimals, (eg 100.123) and with just that information, determine whether the dot is to be considered a decimal or a thousands separator.

well, i guess i will have to open each file and convert the column to number from text because this is basically the problem. There are rows looking like 1.001,2 other like 50,4 (without the dot as thousand-separator) or 4.3 and this column being initially set as text i get huuge numbers out after converting to number idk why.

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.

Top Solution Authors