+ Reply to Thread
Results 1 to 8 of 8

Match values from a query table to a table with fixed rows and columns

  1. #1
    Registered User
    Join Date
    07-11-2019
    Location
    Portugal
    MS-Off Ver
    office 365
    Posts
    6

    Match values from a query table to a table with fixed rows and columns

    Hello fellow forum members,

    i have a question regarding how can i put values from a table that is changing based on a power query in to a new fixed "pivot table" . for example:

    i have this data

    NAME COUNTRY AGE

    ana brasil 10

    peter france 20

    grace spain 30

    and i have a new spreadsheet with fixed rows with NAME and columns with COUNTRY , i just want to put the AGE in the correct order like this :

    ------brazil----france--spain

    ana --10--------------------

    peter ----------20------------

    grace -------------------30---


    Remember that the origin table will change the all the data but i have fixed the position of the NAMEs and LOCATIONs in the second table .

    Hope you understand my problem.
    thank you!

    Best Regards
    Last edited by AliGW; 07-15-2019 at 07:21 AM. Reason: Thread correctly tagged as solved.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Match values from a query table to a table with fixed rows and columns

    You could use CUBEVALUE functions.

    Load your Power Query data to the data model, and create an explicit Measure for Age - something like:
    Please Login or Register  to view this content.
    Now you can layout your fixed table, and use CUBEVALUE formulae, like:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See attached workbook for worked example.
    Attached Files Attached Files
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    07-11-2019
    Location
    Portugal
    MS-Off Ver
    office 365
    Posts
    6

    Re: Match values from a query table to a table with fixed rows and columns

    Hey Olly !
    you absolutely nailed my problem, thank you for that!
    However im strugling with the step "create an explicit Measure for Age" i see that option in pivot menu table but i think its not there that i should add the code.
    Could you elaborate more ?
    thanks again!
    Last edited by AliGW; 07-12-2019 at 07:10 AM. Reason: Please don't quote unnecessarily!

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Match values from a query table to a table with fixed rows and columns

    Click Power Pivot > Data Model > Manage. This takes you to the Power Pivot window.

    Now in the grid at the bottom of each table, you can create MEASURES.

    In the file I uploaded, you'll see the measure [Age Measure] in the grid at the bottom of Table1. Click on that cell of the grid, and the DAX code for the measure is displayed in the formula bar (you can expand the formula bar down to display more).

    Alternatively, you can click Power Pivot > Calculations > Measures > Manage Measures, then you can add / change measures via a series of dialogs.

  5. #5
    Registered User
    Join Date
    07-11-2019
    Location
    Portugal
    MS-Off Ver
    office 365
    Posts
    6

    Re: Match values from a query table to a table with fixed rows and columns

    Hey Olly, i made like you suggested , however there is no match for sample test :/

  6. #6
    Registered User
    Join Date
    07-11-2019
    Location
    Portugal
    MS-Off Ver
    office 365
    Posts
    6

    Re: Match values from a query table to a table with fixed rows and columns

    you can see in the attached image
    Attachment 632033

  7. #7
    Registered User
    Join Date
    07-11-2019
    Location
    Portugal
    MS-Off Ver
    office 365
    Posts
    6

    Re: Match values from a query table to a table with fixed rows and columns

    UPDATE, i made the same steps as you have in the example and it does work, however with my tabel it does not find matchs and shows the error #N/D :/

  8. #8
    Registered User
    Join Date
    07-11-2019
    Location
    Portugal
    MS-Off Ver
    office 365
    Posts
    6

    Re: Match values from a query table to a table with fixed rows and columns

    New update, i figured out what was the problem, seems that there were som empty spaces that was causing the missmatch .
    Thank you once again Olly .

+ 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. Insert blank rows above a table based on unique values in one of the columns in the table
    By carlito2002wgn in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-08-2019, 01:06 PM
  2. Insert blank rows above a table based on unique values in one of the columns in the table
    By carlito2002wgn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2019, 07:52 PM
  3. [SOLVED] Compare Two Tables and Return Values Only on Rows that Match the other Table
    By Alienontherun in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-27-2018, 06:41 AM
  4. [SOLVED] add rows each x minutes to table wich fixed # of rows.
    By jrtaylor in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-21-2018, 03:28 PM
  5. [SOLVED] Get values from varying rows and columns of Pivot Table and enter those in different table
    By Richavlaues in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-25-2016, 10:24 AM
  6. Replies: 13
    Last Post: 10-13-2015, 04:17 AM
  7. Replies: 4
    Last Post: 06-13-2013, 09:06 AM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1