Is there a way to control the filters in selecting values in queries based on the values given
lets say, I have the following power query, data looks like the following
country type value1 value2....
----------------------------------------------------------------------
USA a1 22 12
Uk a2 21 10
Now in power query, I manually filter these values to make like country="USA", type="a1" to get the pivot tables.
How to filter the values automatically using the user inputs in power query?
User inputs:
country: [textbox] or workbook cell
type : [textbox] or workbook cell
Anly help is appreciated, thanks!
PS: My working query looks like the following,
let
Source = Csv.Document(File.Contents("C:\Users\axlptl\Desktop\abc.csv"),[Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None]),
UserInput = Excel.CurrentWorkbook(){[Name="Table1"]}[Content][country]{0},
#"Promoted Headers" = Table.PromoteHeaders(Source),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"country", type text}, {"type", type text}, {"value1", Int64.Type}, {"value2", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([type] = UserInput))
in
#"Filtered Rows"