PowerPivot Indirect Dynamic Column Reference

jolee217

New Member
Joined
Jun 29, 2017
Messages
11
It seems like such an easy thing: As I would do in excel, I just want to use a cell in my row to determine which column to return value from.

An example of my (VERY simplified) table "tTable" is:

PartDefault VendorSupplier1Supplier2Supplier3Price @ Default Supplier
Material1Supplier11.001.251.30
Material2Supplier24.104.004.15
Material3Supplier33.703.403.00

<tbody>
</tbody>

In excel I would write this in F2:

=VLOOKUP([@Part], tTable, MATCH([@Vendor],tTable[#Headers],0), FALSE) = $1.00
OR
=ADDRESS(ROW(),COLUMN(INDIRECT("tTable["&tTable[@Vendor]&"]")))=$1.00


However, I'm trying to do this same thing in PowerPivot. My data is essentially the same. What I WANT to do is:

=LOOKUPVALUE(INDIRECT("tTable["&[Vendor]&"]"), [Part], [Part])

Which obviously doesn't work. I am out of ideas and cannot find a solution online. Excel does not work since the data set is far too large, and powerpivot is my only alternative.

Is there a formula for looking up a dynamic column in PowerPivot?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Index1 = Table.AddIndexColumn(Source, "Index", 0, 1),
    Unpivot1 = Table.UnpivotOtherColumns(Index1, {"Part", "Default Vendor", "Index"}, "Attribute", "Value"),
    #"Merged Queries" = Table.NestedJoin(Index1,{"Default Vendor", "Index"},Unpivot1,{"Attribute", "Index"},"Table2",JoinKind.LeftOuter),
    #"Expanded Table9" = Table.ExpandTableColumn(#"Merged Queries", "Table2", {"Value"}, {"Price @ Default Supplier"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Table9",{"Index"})
in #"Removed Columns"

Table1=table with header rows, all columns except the Price@DefaultShipper column
 
Last edited:
Upvote 0
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Index1 = Table.AddIndexColumn(Source, "Index", 0, 1),
    Unpivot1 = Table.UnpivotOtherColumns(Index1, {"Part", "Default Vendor", "Index"}, "Attribute", "Value"),
    #"Merged Queries" = Table.NestedJoin(Index1,{"Default Vendor", "Index"},Unpivot1,{"Attribute", "Index"},"Table2",JoinKind.LeftOuter),
    #"Expanded Table9" = Table.ExpandTableColumn(#"Merged Queries", "Table2", {"Value"}, {"Price @ Default Supplier"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Table9",{"Index"})
in #"Removed Columns"

Table1=table with header rows, all columns except the Price@DefaultShipper column


I am unsure how to add/apply this code. I'm inside PowerPivot, not PowerBI.

Thoughts?
 
Upvote 0
This is M language for PowerQuery, for which the step by step for my version of Excel would be:

Highlight excel range of source data [here from word "Part" in top left to number "3.00" in bottom right]
Data..From Table/Range...
[x] my table has headers
Home...Advanced Editor...
[Paste code above in replacement of code on screen]
[Done button]
File...Close and Load...
 
Upvote 0

Forum statistics

Threads
1,215,262
Messages
6,123,952
Members
449,135
Latest member
jcschafer209

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top