PowerQuery : Excel Parameters RRS feed

  • Question

  • I am new to power query and attempting to create a sheet where I can just input a customer name and update the query

    I have followed some different tutorials but seem to be stuck

    Here is my parameter table

      Source = Excel.CurrentWorkbook(){[Name="Customer"]}[Content],
      Customer1 = Source{0}[Customer]

    and my query 

      Customer = Excel.CurrentWorkbook(){[Name="Customer"]}[Content],
      Customer_Name = Customer{0}[Customer],
      Source = Sql.Database("SERVER", "DATABASE", [Query="SELECT i.PriorityType as 'PRIORITY','COUNT' = COUNT(i.IncidentID)#(lf)FROM table #(lf)WHERE IncidentType IN ('Customer Support','Managed Services')#(lf)AND Organization = Customer_Name#(lf)AND IsResolved = 0#(lf)AND Active = 1#(lf)AND StateType = 'Open'#(lf)GROUP BY i.PriorityType#(lf)ORDER BY CASE#(lf) WHEN i.PriorityType = 'Code Red' THEN 1#(lf) WHEN i.PriorityType = 'Code Red RCA' THEN 2#(lf) WHEN i.PriorityType = 'High' THEN 3#(lf) WHEN i.PriorityType = 'Medium' THEN 4#(lf) WHEN i.PriorityType = 'Low' THEN 5#(lf)END ASC"])

    Pretty much I wanted to be able to where customer = the value in the parameter cell any help would be greatly appreciated

    • Edited by COndrovic Monday, March 2, 2015 10:13 PM sanitize
    Monday, March 2, 2015 10:13 PM


  • In your query string, the variable Customer_Name is not replaced by its value.
    You need to write something like  "SELECT ....Organization =" & Customer_Name & "#(lf)AND I.... ASC"])"
    Tuesday, March 3, 2015 12:48 PM