locked
Power Query : Procedure and code reuse RRS feed

  • Question

  • Hello,

    I 'am using Power query to process some Data Crunching to make data set for testing.

    I would like to realise a "procedure like" to add the same Fields and control to several existing Power Query requests.

    I have seen some function creation but it work only for a field set up.

    Is it possible ?

    Thanks in advance

    Example :

    Each request must have :

    - A new Link Column filled with 1

    - A New incremental filed called Key

    - Four mesures filled with a calculation based on the key.

    Monday, January 9, 2017 3:24 PM

Answers

  • When you say the Index field must be distinct for each table, do you mean that an Index value in Table 1 must not occur in Table 2?

    Have you considered appending (in PQ) all these tables that share a common format together into a single dataset, and then doing the above transforms on all the rows at once?

    Ehren

    Friday, January 20, 2017 7:08 PM

All replies

  • Yes, this is definitely possible. Could you provide a sample of a few rows showing how the data would look before and after this function runs?

    Ehren

    Monday, January 9, 2017 7:52 PM
  • Hi Jerome,

    is this still an issue?


    Imke Feldmann TheBIccountant.com

    Sunday, January 15, 2017 8:17 AM
  • Possibly my solution in this thread will be helpful for you.
    Sunday, January 15, 2017 5:48 PM
  • Hi Marcel,

    Sorry I was disconnected and didn't receive the forum messages.

    Here are my samples:

    Table 1 Table 2
    Code1 Label1 Amount Cogs Code2 Label2 Amount Cogs
    01 Chair 1.1 0.2 01 Chair 1.1 0.2
    02 Table 2.1 0.3 02 Table 2.1 0.3

    I Have to manage a 100 table that have common fields and other.

    In each Power Query request I have to click on the same operations that I would like to call with a procedure :

    - Formating amount and cogs as numeric

    - Create an Index field that must be distinct for each table.

    - Calculate the Net Sales value (Amount - Cogs)

    .....

    Thanks

    Friday, January 20, 2017 3:48 PM
  • When you say the Index field must be distinct for each table, do you mean that an Index value in Table 1 must not occur in Table 2?

    Have you considered appending (in PQ) all these tables that share a common format together into a single dataset, and then doing the above transforms on all the rows at once?

    Ehren

    Friday, January 20, 2017 7:08 PM