Forum Discussion
Parameter to switch between source queries
Hi RSK,
Are you trying to use query parameter to select data source? If you are , you can directly use "ParameterName", not "= ParameterName". For details, please refer to: http://biinsight.com/power-bi-desktop-query-parameters-part-1/.
Regards,
Jimmy Tao
- Anonymous8 years agoNot applicable
Like this?
let
Source = AppInsights,
#"Removed Other Columns" = Table.SelectColumns(Source,{"Browser"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"),
#"Renamed Columns" = Table.RenameColumns(#"Removed Duplicates",{{"Browser", "BrowserName"}}),
#"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 1, 1),
#"Renamed Columns1" = Table.RenameColumns(#"Added Index",{{"Index", "BrowserID"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns1",{{"BrowserID", Int64.Type}})
in
#"Changed Type"-------------------
AppInsights is my parameter name. It still gives me this error on the second step:
Expression.Error: We cannot convert the value "AppInsightsSQL (Api)" to type Table.
Details:
Value=AppInsightsSQL (Api)
Type=Type--------------
AppInsightsSQL (Api) is my default source query.
What am I missing here?
Thanks.
- v-yuta-msft8 years agoCommunity Support
Hi RSK,
"Expression.Error: We cannot convert the value "AppInsightsSQL (Api)" to type Table.
Details:
Value=AppInsightsSQL (Api)
Type=Type"<--- Modify Code as pattern below and check if it can work.
Source = Sql.Database(InstanceNames, Databases, [Query = "Select * from *"])(e.g.: InstanceNames and Databases are parameters)
Regards,
Jimmy Tao
- Anonymous8 years agoNot applicableThanks Jimmy, but as stated in my original post, only one of my sources is a SQL db, the other is an Azure Table Store. So that is why I need a parameter to switch between those two source queries regardless of the original sorce type. Hope it makes more sense now.