Forum Discussion
Assistance with SQL Parameters in Power BI - Help with creating a list from SQL Query
- 7 years ago
v-cherch-msft, The following worked for me. I was getting my tables and schema mixed up. Also, I needed to use the "each" function to populate the column.
let Source = Sql.Database("localhost", "AdventureWorks2014"), Production_ProductCategory = Source{[Schema="Production",Item="ProductCategory"]}[Data], #"Added Custom" = Table.AddColumn(Production_ProductCategory, "CategoryName", each ProductCategory.Name), CategoriesList = #"Added Custom"[Name], #"RemovedDuplicates" = List.Distinct(CategoriesList) in RemovedDuplicates
Hi ck18
Here is the document for you:
https://www.excelguru.ca/blog/2016/04/28/pass-parameters-to-sql-queries/
Regards,
Cherie
- v-cherch-msft7 years agoMicrosoft Employee
Hi ck18
Would you share your solution and mark it as solution? That way, other community members will easily find the solution when they get same issue.
Regards,
Cherie
- ck187 years agoFrequent Visitor
v-cherch-msft, The following worked for me. I was getting my tables and schema mixed up. Also, I needed to use the "each" function to populate the column.
let Source = Sql.Database("localhost", "AdventureWorks2014"), Production_ProductCategory = Source{[Schema="Production",Item="ProductCategory"]}[Data], #"Added Custom" = Table.AddColumn(Production_ProductCategory, "CategoryName", each ProductCategory.Name), CategoriesList = #"Added Custom"[Name], #"RemovedDuplicates" = List.Distinct(CategoriesList) in RemovedDuplicates- v-cherch-msft7 years agoMicrosoft Employee
Hi ck18
Thanks for your share. Please accept your answer as solution so that other community members will easily find the solution when they get same issue.
Regards,
Cherie