Forum Discussion
ck18
7 years agoFrequent Visitor
Assistance with SQL Parameters in Power BI - Help with creating a list from SQL Query
So I have been trying to follow this link to create a list in Power BI. For a little background, I am attempting to create a dataset within Power BI that has products, their list price, quantities so...
- 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
ck18
7 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
RemovedDuplicatesv-cherch-msft
7 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