Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Query as a source in Parameter - How to?

I am trying to use "Query" as a source for a parameter in Power BI. I can select "Query" as suggested value, however the "Query" field is greyed out.

 

Can some one help?

 

 
 
  • Hey Anonymous ,

     

    here https://docs.microsoft.com/en-us/power-query/power-query-query-parameters#creating-query-parameters you will find this little sentence "and then restrict the acceptable values for that parameter to a static list of Text values". The static list is the query. To have this option available it's necessary to first create a list.

    In the query editor you can create a very simple list by adding a Blank Query:

    in the "Advanced Editor"

    Replace everything with this code:

     

    let
        Source = {"a", "b"}
    in
        Source

     

    And you will have created your first list

    Beware of the different icon 😉

     

    Now you use this list as input for the query.

     

    Hopefully, this is what you are looking for.

     

    Regards,

    Tom

     

     

     

2 Replies

  • Hey Anonymous ,

     

    here https://docs.microsoft.com/en-us/power-query/power-query-query-parameters#creating-query-parameters you will find this little sentence "and then restrict the acceptable values for that parameter to a static list of Text values". The static list is the query. To have this option available it's necessary to first create a list.

    In the query editor you can create a very simple list by adding a Blank Query:

    in the "Advanced Editor"

    Replace everything with this code:

     

    let
        Source = {"a", "b"}
    in
        Source

     

    And you will have created your first list

    Beware of the different icon 😉

     

    Now you use this list as input for the query.

     

    Hopefully, this is what you are looking for.

     

    Regards,

    Tom

     

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Tom. It works!