Forum Discussion

blind_user's avatar
blind_user
Regular Visitor
3 years ago
Solved

Excel power query

hello dears   it's my first post here, i'm visually impaired, use excel power query via screen-reader. i plan to learn power bi , but didn't start yet. i usually collect data from external source...
  • rubayatyasmin's avatar
    rubayatyasmin
    3 years ago

    Hi there, 

     

    Correction for the previous code. We need to use Text. Replace not replaceRange. Here is the updated code. 

     

     

    let's use the Text.Replace function to replace each Hindi numeral with the corresponding Arabic numeral:

     

     
    let HindiToArabic = (hindiNumeral as text) as text => let arabicNumeral = Text.Replace(Text.Replace(Text.Replace(Text.Replace(Text.Replace(Text.Replace(Text.Replace(Text.Replace(Text.Replace(Text.Replace( hindiNumeral, "०", "0"), "१", "1"), "२", "2"), "३", "3"), "४", "4"), "५", "5"), "६", "6"), "७", "7"), "८", "8"), "९", "9") in arabicNumeral in HindiToArabic
     

    In this corrected function:

    1. HindiToArabic is a function that takes a string hindiNumeral as an input.

    2. This function contains a series of Text.Replace operations. Each operation replaces a Hindi numeral in hindiNumeral with the corresponding Arabic numeral. For instance, "०" is replaced with "0", "१" is replaced with "1", and so forth.

    3. After all replacements have been made, the function returns the resulting string arabicNumeral, which contains the original string but with all Hindi numerals replaced by their corresponding Arabic numerals.

    This function can then be used in Power Query to convert columns containing Hindi numerals to Arabic numerals. Note: this solution assumes that the Hindi numerals are in Unicode format. If they're not, this function may not work correctly.

     

     

    For your last question, To apply changes on multiple column, I do not know if PQ provides text conversion like this. You can change data type at once by selecting similar data type columns. But language conversion will not be possible. You need to use replace or toText for that. 

    this document will be helpful. 

     

    Type conversion - PowerQuery M | Microsoft Learn