# Converting Query to Parameters



## Misca (Sep 15, 2017)

I'm trying to learn how to use parameters in my Power Query queries.

The "main" query gets order data from an Excel table and I'm trying to build a Calendar table based on Order Dates in that query. 

Normally I'd create the calendar table in the Power Pivot (yeah, I'm doing this in Power Pivot because Excel workbooks are much easier to spread around than the Power BI reports) but I want to include the public holidays in my Calendar so I'm using another query to get the holidays from a web service. For that I need the first and the last year from my Orders query so I've built a couple of queries that return the first / last year as a list:


```
let    Source = Orders,
    #"Calculated Earliest" = Date.Year(List.Min(Source[OrderDate]))
in
    #"Calculated Earliest"
```

Now I'd like to convert those queries as parameters but I can't select the Convert To Parameter -selection from the Query Settings. It doesn't seem to be grayed out but it just ignores my mouse cursor on that row. I could use the Create Function -option right before it but it just won't let me select the Convert To Parameter.

What am I doing wrong / How can I make it allow me to use the query as a parameter?


----------



## systematical88 (Aug 29, 2018)

I had what I think was the exact same issue because I was trying to use a query on a table as the source for my parameter list so it would be fully dynamic. I couldn't find a solution anywhere on the internet (which is how I ended up here).

I have solved my issue with a combination of luck and a series of continual fumbling around. If you think about what we were trying to do, we were passing a whole table as a query into the values. Which column *should* the program use? To solve this, you need to open they query editor and the table you want then right click the particular column you want to use and select "convert to list". Once you do that, you should be able to select the converted list from the "Query" option box inside of the parameter creation dialog.


----------

