Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
lukaszbrdon
Frequent Visitor

Multi value in one dynamic M query parameter

Hi all,

 

I need to pass multiple values to single parameter which is added as 'where' clause to query. There is no static list of these values. It's dynamically changing. I'm receiving values to parameters from RLS Customdata() function, which has impact on column of values for parameter. I would like to pass these values to single parameter in 'where' clause.

 

Can you advise me how to achieve? 

 

 

 

 

 

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

Hi all,

 

let

   

    PARAMETER_LIST  =

 

if

    //check to see if the parameter is a list

      Type.Is(

        Value.Type(PARAMETER),

        List.Type

      ) then

        //if it is a list

        let

          //add single quotes around each value in the list

          AddSingleQuotes = List.Transform(

              PARAMETER,

              each "'" & _ & "'"

            ),

          //then turn it into a comma-delimited list

          DelimitedList = Text.Combine(

              AddSingleQuotes,

              ","

            )

        in

          DelimitedList

    else

 

    "'"& PARAMETER_LIST  &"'",

  

    Source = Oracle.Database("XXX [HierarchicalNavigation=true, Query="
Select * from xxx join xxx on bbb=aaa

       where column ='"& PARAMETER_LIST &"'"])

in

    Source

but I'm receiving the error like below:

DataSource.Error: Oracle: ORA-00933: SQL command not properly ended
Details:
DataSourceKind=Oracle
DataSourcePath=xxx
Message=ORA-00933: SQL command not properly ended
ErrorCode=-2147467259

 

Without "where" clause Idon't get error.

 

Can anybody advice?

 

Hi all,


I have sth like that for now.

let

   

    PARAMETER_LIST  =

 

if

    //check to see if the parameter is a list

      Type.Is(

        Value.Type(PARAMETER),

        List.Type

      ) then

        //if it is a list

        let

          //add single quotes around each value in the list

          AddSingleQuotes = List.Transform(

              PARAMETER,

              each "'" & _ & "'"

            ),

          //then turn it into a comma-delimited list

          DelimitedList = Text.Combine(

              AddSingleQuotes,

              ","

            )

        in

          DelimitedList

    else

 

    "'"& PARAMETER_LIST  &"'",

  

    Source = Oracle.Database("XXX [HierarchicalNavigation=true, Query="
Select * from xxx join xxx on bbb=aaa

       where column ='"& PARAMETER_LIST &"'"])

in

    Source

but I'm receiving the error like below:

DataSource.Error: Oracle: ORA-00933: SQL command not properly ended
Details:
DataSourceKind=Oracle
DataSourcePath=xxx
Message=ORA-00933: SQL command not properly ended
ErrorCode=-2147467259

 

Without "where" clause Idon't get error.

 

Can anybody advice?

This might be too late for you but it could help someone else.

 

I think in the Where clause you should use IN not '='. And add brackets around the list: 

Use:  Where column IN ("& PARAMETER_LIST &")

So it would give you: Where column IN ('a','b')

Instead of giving you: Where colum = 'a','b'

 

Daryl-Lynch-Bzy
Community Champion
Community Champion

Hi @lukaszbrdon  - have you consider using the List.Contains function to filter the table.  This should fold to the source.  Here is example to consder:

Filter Column by List Items (Exact Match) in Power Query - YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.