Forum Discussion

rahul_dt's avatar
rahul_dt
Frequent Visitor
2 years ago

Pass SelectedValue's ID as Parameter to a DirectQuery

Let's say I have a table as below which I've created a DirectQuery Dataset of in my Power Bi Desktop

SELECT * FROM CUST

IDName
1Michael
2Jim
3Pam


I have created a slicer over the column Name, however, I want to map the corresponding ID with the M Query Parameter so I can achieve the below requirement.

I have another Table as below that I'm trying to import in DirectQuery using M Query Parameters 

SELECT * FROM CUST_INFO WHERE CUST_ID = *id_param*

 

the id_param needs to be linked to the ID column of the CUST table, however, I don't want to create a slicer on the ID column, instead I want to create the slicer on the Name column so the user can select a name and a card/table visual refreshes and displays the selected users information.

 

Is there a way to do this such that I don't have to convert either of these table to Import Mode? Business requires it to be a DirectQuery.

 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rahul_dt ,

     

    Currently, only one field can be bound to an M parameter.
    Dynamic M query parameters in Power BI Desktop - Considerations and limitations

     

    If the ID and Name are one-to-one, you can modify the query to apply the conditions that were previously applied to the [ID] to the [Name], so that [Name] can be used as the slicer value.

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

    • rahul_dt's avatar
      rahul_dt
      Frequent Visitor

      Hi, thanks for your reply!

      I understand only one field can be bound to an M parameter, but I'd like to use the [Name] column as slicer values, however, the parameter must be bound to [ID] column. 

      And on the basis of what slicer value is selected, the corresponding ID values must be passed to the second query.

      The [ID] and [Name] columns both belong to the same table such that the [ID] column is a primary key

      Please let me know if I can provide more information to help provide a context.

  • I alos have exact same requirement. Please let me know if there is any solution

  • Hi, did you ever find a solution or workaround for this? I need to do the same...
    many thanks