【发布时间】:2016-12-04 05:34:26
【问题描述】:
有没有办法控制过滤器根据给定的值在查询中选择值
让我们说, 我有以下电源查询,数据如下所示
country type value1 value2....
----------------------------------------------------------------------
USA a1 22 12
Uk a2 21 10
现在在电源查询中,我手动过滤这些值,使之像 country="USA", type="a1" 以获取数据透视表。
如何在电源查询中使用用户输入自动过滤值?
用户输入:
country: [textbox] or workbook cell
type : [textbox] or workbook cell
感谢您的帮助,谢谢!
PS:我的工作查询如下所示,
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"
【问题讨论】:
-
您希望用户输入来自哪里?
-
@AlejandroLopez-Lago-MSFT :修改了问题
标签: excel powerquery vba