+ Reply to Thread
Results 1 to 5 of 5

How to add an Excel formula code into Power Query or create a new one in Power Query

  1. #1
    Forum Contributor
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    365
    Posts
    122

    How to add an Excel formula code into Power Query or create a new one in Power Query

    HI,

    I would like to use advance formula form excel in Power Query. In fact, I have the ready to paste code, but simple copy/paste does not work. Can you pls hel me.

    Below, I have pasted the code that I want to paste.

    Moreover, pls find the excel file with:

    - source for PQ
    - code: almost final, but without formula

    Second attached file ('excel formula'), is just to let you know the original formula - last colums

    the excel formula, which I want to have in PQ. the code below, is the one I know work in other spreadsheet. It does not have to be the same in the file attached.
    HTML Code: 
     GaugeText = (GaugeInput) =>
            let
                #"Replace 0" = Text.Replace(GaugeInput,"0",""),
                #"Replace ." = Text.Replace(#"Replace 0",".",""),
                #"Replace MM" = Text.Replace(#"Replace ."," MM",""),
                #"Replace Second Choice" = Text.Replace(#"Replace MM","SECOND CHOICE",""),
                #"Replace 12 with 2" = Text.Replace(#"Replace Second Choice","12","2")
            in
                #"Replace 12 with 2",
        #"Added Barrel Description" = Table.AddColumn(#"Added Revenue", "Opis beczki", each if [Product Line] <> "Large Steel Drums>=44G/160ltr+" then null else Text.Combine({Text.Combine(List.ReplaceMatchingItems({Text.Start([Item Description],2)},{{"OL","OH"},{"RL","OH"},{"RH","OH"},{"TC","TH"}})),GaugeText([Top Gauge]) & GaugeText([Body Gauge]) & GaugeText([Bottem Gauge]),if Text.Middle([Item Description],22,1) = "L" then " IC" else null}," "), type text),
    Attached Files Attached Files
    Last edited by afgi; 02-17-2020 at 03:27 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    50,075

    Re: Power Query - excel formula attached

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    365
    Posts
    122

    Re: Power Query - excel formula attached

    hi,

    thanks for your help. I have changed the title, hope this will work

  4. #4
    Forum Contributor
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    365
    Posts
    122

    Re: How to add an Excel formula code into Power Query or create a new one in Power Query

    hi

    I know where the problem was:
    - comma before I paste the code in line above
    - in below code, there should be a name of preciding step

    #"Added Barrel Description" = Table.AddColumn(#"Added Revenue",...

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    41,281

    Re: How to add an Excel formula code into Power Query or create a new one in Power Query

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel Power Query Refresh or Access Query - 2nd Query Run is faster
    By Steveapa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2020, 10:16 AM
  2. [SOLVED] Power Pivot does not load new column added in Power query
    By ibuhary in forum Excel General
    Replies: 12
    Last Post: 02-19-2019, 03:53 AM
  3. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  4. IF Formula in Power Query
    By orhanceliloglu in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-03-2018, 05:04 AM
  5. Replies: 0
    Last Post: 04-05-2018, 01:16 AM
  6. Power query formula
    By orhanceliloglu in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-19-2017, 11:28 AM
  7. [SOLVED] Is there a way to add a normal excel formula to a Power Query Table
    By beaglesBuddy in forum Excel General
    Replies: 1
    Last Post: 07-09-2016, 04:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts