Query for input via drop-down, output combination of two tables

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,922
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm working from a PC I can't install screen grabbing software on, I hope I can explain this as clearly as possible:

I have two tables: Data and Headers which are loaded into PQ as connection only:

Data:
Power Query:
let
    Source = Csv.Document(File.Contents("XXX"),[Delimiter=",", Columns=42, Encoding=65001, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Fund Name", type text}, {"Fund Class Name", type text}, {"Fund Class Status Is 'Activated'", type text}, {"Fund Class Start Date", type date},{"Class Type", type text}}),
   
    /* Process data */
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Fund Status] = "Launched") and ([#"Fund Class Status Is 'Activated'"] = "Yes") and ([Income Distribution Treatment] = "Accumulation")),      

    /* Tidy up */
    #"Tidy Up" = #"Filtered Rows"
in
    #"Tidy Up"

Header:
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="tbl_Input_Headers"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Pillar ID", type text}, {"Pillar Label Name", type text}, {"Type", type text}, {"Data Type", type text}, {"Min Value", Int64.Type}, {"Max Value", Int64.Type}, {"Calculation", type any}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Type", "Data Type", "Min Value", "Max Value", "Calculation"})
in
    #"Removed Columns"

I have a drop-down list which contains unique values from the key column in the Data table

I wish to create an output table for the User to fill in as follows:

3 matching columns from the Data table based on the selected drop-down value AND all rows from the Headers table transposed as column headers next to the 3 matching columns


I'm not sure how to use a Query to filter the data and then further code to create the output by joining, can anyone suggest?

The output table is defined as tbl_Output and I currently use the FILTER function to return the matches from the Data table

TIA,
Jack
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,702
Messages
6,173,969
Members
452,539
Latest member
delvey

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