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
Suresh777
Regular Visitor

Target Currency format is EURO (5.000,00) & Input source has combination of collapsed formats

Hello Techies,

 

I am beginner in Power Query however I need to solve some important issues which face in my work.

 

We are using EURO currency foramat. Ex. for Five Thousand Euros and cents we write as 5.000,00 €. In general english format is 5,000.00 $.

 

I have to consider tables from standard PDF invoice vouchers. Many of the table I get as actual format in EURO what I need. But few of them people used to make it in English format.

 

When I call the table in Power Query the english format shows error then I need to make manual replace like below. Sometimes I failed to observe all the errors and it takes huge manual efforts.

 

Suresh777_0-1665310967195.png

 

I searching for a formulae to filter the error value automatically instead manual work.

 

Thanks for your time and help.

 

Regards

Suresh

Whatsapp (+49 15166330777)

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

All of your examples show a number with two decimal places.

If all of the values will have two decimals then:

  • Initially set the data type to text.
  • Remove all of the separators
  • Convert back to a number
  • divide by 100

Source formatted as text

ronrsnfld_0-1665363380086.png

 

 

 

let

//change next line to reflect actual data sournce
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],

//ensure price column is set as text
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Unit Price", type text}}),

//remove all separators and divide by 100
    #"Remove Separators" = Table.TransformColumns(#"Changed Type",{"Unit Price", 
        each Number.From(Text.Remove(_,{",","."})) / 100}),

//set data type to currency (or number, if you prefer)
    #"Set Type" = Table.TransformColumnTypes(#"Remove Separators",{"Unit Price", Currency.Type})
in
    #"Set Type"

Results as currency

ronrsnfld_1-1665363433391.png

 

 

 

View solution in original post

4 REPLIES 4
ronrsnfld
Super User
Super User

All of your examples show a number with two decimal places.

If all of the values will have two decimals then:

  • Initially set the data type to text.
  • Remove all of the separators
  • Convert back to a number
  • divide by 100

Source formatted as text

ronrsnfld_0-1665363380086.png

 

 

 

let

//change next line to reflect actual data sournce
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],

//ensure price column is set as text
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Unit Price", type text}}),

//remove all separators and divide by 100
    #"Remove Separators" = Table.TransformColumns(#"Changed Type",{"Unit Price", 
        each Number.From(Text.Remove(_,{",","."})) / 100}),

//set data type to currency (or number, if you prefer)
    #"Set Type" = Table.TransformColumnTypes(#"Remove Separators",{"Unit Price", Currency.Type})
in
    #"Set Type"

Results as currency

ronrsnfld_1-1665363433391.png

 

 

 

Hi,

 

It is really simple and powerful solution. 🍻

GREAT !

Thanks for your help.

 

Regards

Suresh

 

Regards

Suresh

Suresh777
Regular Visitor

I have tried it. It doesn't work. It only accepts the correct input consisting comma. Please see the samples below.

Power query requires the below samples as correct with comma.

Suresh777_2-1665350922775.png

But,

Original input consists below error. It supposed to be 1,45. 

Suresh777_0-1665350740551.png

 

After applying the step change type to Fixed Decimals (or) Changing Local --> Fixed Decimal as German.

Suresh777_1-1665350909774.png

 

Sometimes I am failed to recognise these kind of errors and it leads to error in total. The perfect idea would be define the fool proof system in the input system.

However It would be great if we identify a solution for these kind of errors.

 

Thanks

Suresh

 

 

Greg_Deckler
Super User
Super User

@Suresh777 Have you tried right-clicking the column and used "Change Type | Using Locale..."?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors
Top Kudoed Authors