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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Kudoed Authors