Forum Discussion

ChainSpart's avatar
ChainSpart
Frequent Visitor
5 years ago
Solved

Parameter Binding - Error (Parameter is not defined in model)

Hello,

 

I'm working with an SQL database that has a view which needs an input parameter to show values. 

This Parameter is related to a table that has a list of names and when we put one of these names in input, the view shows its values.

 

In SQL, the request looks like this :

SELECT TOP (1000) [DateTime],[TagName],[Value] FROM [Run].[dbo].[History] WHERE [TagName] = '" &parameter1 &"'"

 

I'd like to have a view in power BI where I'll have this tagname as a filter (already done) -unique selection- and then, a table that shows all values for the selected tagname.

 

So far, I have created a parameter in power query to be able to get values from the view. So when I stay in the Power Query Editor, I can see values each time I put a valid tagname in the parameter.

 

But when I go in the Power BI view creation, the filter doesn'"t work and I can't maange to see anything.

I've tried to use the Parameter binding option (in preview) to the TagName, but it doesn't work also and show the error " Parameter is not defined in model".

 

can anyone help me with this please ?

 

Thanks 🙂

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi ChainSpart,

    I think you want to use the selected value from the slicer/filter to affect the backend query tables and send them to your database, right?

    If that is the case, you can't achieve this requirement. AFAIK, they are host on different data levels and you can't use child level to affect its parent.

    Notice: the data level of power bi.

    Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

    Regards,

    Xiaoxin Sheng

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ChainSpart,

    For your requirements, you can create a query parameter and concatenate it with your connection string.

    let
        Source = Sql.Database("test", "test", [Query="SELECT TOP (1000) [DateTime],[TagName],[Value] FROM [Run].[dbo].[History] WHERE [TagName] = "& Parameter1 ])
    in
        Source

    Regards,
    Xiaoxin Sheng

    • ChainSpart's avatar
      ChainSpart
      Frequent Visitor

      Hi,

       

      Thanks for your answer. Unfortunately, I already tried that and used this parameter as the Parameter binding. My 1st post wasn't complete it seems.

      But when I do use the Parameter binding to this parameter1, it doesn't work, I can't see anything in my table view.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi ChainSpart,

        I think you want to use the selected value from the slicer/filter to affect the backend query tables and send them to your database, right?

        If that is the case, you can't achieve this requirement. AFAIK, they are host on different data levels and you can't use child level to affect its parent.

        Notice: the data level of power bi.

        Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

        Regards,

        Xiaoxin Sheng