Forum Discussion
ck18
7 years agoFrequent Visitor
Assistance with SQL Parameters in Power BI - Help with creating a list from SQL Query
Sorry, repeating as my first question was marked as spam. I removed the link which I assume is why my post was removed. I have been trying to follow this link to create a list in Power BI. For a ...
- 7 years ago
Not sure how your data exactly looks like, but you can try this one as a start:
let Source = Sql.Database("localhost", "AdventureWorks2014"), Production_ProductCategory = Source{[Schema="Production",Item="ProductCategory"]}[Data], #"Added Custom" = Table.AddColumn(Production_ProductCategory, "ProductCategoryID", each [Name]), CategoriesList = #"Added Custom"[ProductCategoryID], #"RemovedDuplicates" = List.Distinct(CategoriesList) in #"RemovedDuplicates"
ImkeF
7 years agoCommunity Champion
Not sure how your data exactly looks like, but you can try this one as a start:
let
Source = Sql.Database("localhost", "AdventureWorks2014"),
Production_ProductCategory = Source{[Schema="Production",Item="ProductCategory"]}[Data],
#"Added Custom" = Table.AddColumn(Production_ProductCategory, "ProductCategoryID", each [Name]),
CategoriesList = #"Added Custom"[ProductCategoryID],
#"RemovedDuplicates" = List.Distinct(CategoriesList)
in
#"RemovedDuplicates"
ck18
7 years agoFrequent Visitor
I’m having trouble accepting your solution but it worked for me.