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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BIanon
Helper V
Helper V

Dynamic query params with multi select (Cannot convert a value of type List to type Text)

Hello Community,

I am working with a Direct Query model where I allow the end user to select some values in slicers and pass these slicers to a query as a query param.

I have one param with numerical Id's which is working fine with multi select:

BIanon_0-1719932521200.png

Implemented in my primary query like this:
Categories = CategoryParameter,

SQL:   AND V.Id IN (" & Categories & ")

I'm trying to achieve the same thing for a param that contains strings.

BIanon_1-1719932642017.png

Implemented like this:

Brand2 = "'" & Text.Combine(List.Transform(Text.Split(BrandParameter2, ","), Text.Trim), "','") & "'",

SQL:   Brand IN (" & Brand2 & ")


The Brand2 step produces this:

BIanon_2-1719932813807.png


The preview also constructs the correct query and returns the correct result.

When I then load it in and bind a Brand columns to my Brandparameter2, I get hit by the following error if I select something in the slicer, it's working with the default value if I don't select anything:

BIanon_3-1719932899586.png


I hope this description is detailed and understandable, if not I will try to get back with any other info you might need. 
Not sure how to fix this issue

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @BIanon 

Based on your description, you can refer to the following link about multiple selections in dynamic paramaters.

https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters#bind-the-...

You can try to add a new paramater in advanced editor.

e.g 

let 
   selextedvalue=if Type.Is(Value.Type(BrandParameter2), List.Type) then  
            Text.Combine({"'",Text.Combine(BrandParameter2,"','"),"'"}) else 
    Text.Combine({"'",BrandParameter2,"'"})
in
.......

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
BIanon
Helper V
Helper V

I actually tried implementing this without luck, but I must have messed something up because now I just pasted your version in and it worked as intended.

Thank you!

Anonymous
Not applicable

Hi @BIanon 

Based on your description, you can refer to the following link about multiple selections in dynamic paramaters.

https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters#bind-the-...

You can try to add a new paramater in advanced editor.

e.g 

let 
   selextedvalue=if Type.Is(Value.Type(BrandParameter2), List.Type) then  
            Text.Combine({"'",Text.Combine(BrandParameter2,"','"),"'"}) else 
    Text.Combine({"'",BrandParameter2,"'"})
in
.......

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors