Forum Discussion

lenfloge's avatar
lenfloge
Regular Visitor
9 months ago
Solved

Dynamic M Query doesn't take value from slicer as parameter

Hi all   I have a problem. After days of trying and searching for errors and consulting forums/chat GPT and so I have no idea what I'm doing wrong.   I want to implement a Dynamic M Query with a ...
  • lenfloge's avatar
    9 months ago

    Ok, finally I found out the problem. 

     

    The is that you cannot have a table for the filter with several columns and showing not only the bindedParamter column in the filter but another field.

     

    So what works:

    Simple Slicer where only the field where the binded Parameter is attached is in the filter field (in my case the "egmId" field)

     

    What no works:

    Simple slicer where only another field (in my case the "identifier" field) of the filter Table is attached in the filter Fields. So it seems there is no way to show another value in the slicer than using for binded parameters filter...

  • Ahmed-Elfeel's avatar
    Ahmed-Elfeel
    9 months ago

    Hi lenfloge,

    The parameter binding mechanism works at the data model level, not the visualization level So when you select a value in the slicer Power BI passes the actual selected value to the parameter (not a mapped/lookup value)

     

    So here is 3 or 4 options or lets called it workarounds you can try it:-

     

    First Option:

    • Modify your filter table to show both values:
    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XcuxEcAgCEDRXajDHUREmCVngaL7jxDT5he/e88D00bjtEBRqWfE6FscLVNtNaXhDS5gasqE9MXQrwNz6txJaHddKHsFju0Fw1dIqSVG9R+8ofcX", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [egmId = _t, Identifier = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"egmId", type text}, {"Identifier", type text}}),
        #"Combined Column" = Table.AddColumn(#"Changed Type", "Display", each [Identifier] & " (" & [egmId] & ")", type text)
    in
        #"Combined Column"
    •  Then bind the parameter to egmId but use the Display column in the slicer

    Second Option:

    • Instead of a standard slicer use a Table visual as your selection mechanism:
      • Create a table visual with your Identifier column
      • Users can click on rows to filter
      • The parameter binding will still work with the underlying egmId

    Third Option :

    • Also consider using customvisuals from AppSource that might handle this mapping better

    Final Option :

    • If this limitation is a deal breaker you might need to:
      • Use Import mode instead of DirectQuery

      • Implement the filtering logic differently

      • Use a different tool that supports this use case natively

    if this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.