Forum Discussion

ck18's avatar
ck18
Frequent Visitor
7 years ago
Solved

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...
  • ck18's avatar
    ck18
    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