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
kz76d9
Frequent Visitor

I'm new, trying to use in clause / REST API

Can you please help me, when I use clause in on filter got an error.
 
let
    listName = "Tbl_XX",
    Source = Json.Document(Web.Contents(baseURL & "/_api/web/lists/getbytitle('" & listName & "')/items", 
    [Query = [
                     #"$select" = "PL_ID, PL_Dtl_Part_Number, PL_Dtl_Qty, PL_Dtl_UM", 
#"$filter" = "PL_ID in ('2308-08162','2308-08161')"
 
 
             ], 
    Headers = [Accept="application/json;odata=nometadata"]])),
    value = Source[value]
 
Thank you!
1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @kz76d9 ,

I have searched the web for some possible solutions, and here is what I found:

According to this article, the in clause is not supported by the SharePoint REST API, which is what you are using to get the data from the SharePoint site. The article suggests using the or operator instead, like this:

#“$filter” = “PL_ID eq ‘2308-08162’ or PL_ID eq ‘2308-08161’”

Alternatively, you can use Power Query parameters to filter the data based on a list of values, as explained in this article. You can create a parameter query that contains the values you want to filter by, and then use it in your main query. For example, you can create a parameter query called PL_ID_List with the following code:

PL_ID_List = {“2308-08162”,“2308-08161”}

Then, in your main query, you can use this parameter to filter the data, like this:

#“$filter” = “PL_ID eq '” & Text.Combine(PL_ID_List,“’ or PL_ID eq '”) & “'”

This will produce the same filter as the previous option, but with more flexibility and readability.

 

Best Regards,
Community Support Team _ kalyj

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
v-yanjiang-msft
Community Support
Community Support

Hi @kz76d9 ,

I have searched the web for some possible solutions, and here is what I found:

According to this article, the in clause is not supported by the SharePoint REST API, which is what you are using to get the data from the SharePoint site. The article suggests using the or operator instead, like this:

#“$filter” = “PL_ID eq ‘2308-08162’ or PL_ID eq ‘2308-08161’”

Alternatively, you can use Power Query parameters to filter the data based on a list of values, as explained in this article. You can create a parameter query that contains the values you want to filter by, and then use it in your main query. For example, you can create a parameter query called PL_ID_List with the following code:

PL_ID_List = {“2308-08162”,“2308-08161”}

Then, in your main query, you can use this parameter to filter the data, like this:

#“$filter” = “PL_ID eq '” & Text.Combine(PL_ID_List,“’ or PL_ID eq '”) & “'”

This will produce the same filter as the previous option, but with more flexibility and readability.

 

Best Regards,
Community Support Team _ kalyj

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

foodd
Super User
Super User

Would you please consider moving this post involving API usage to the Microsoft Power BI Community Developer Forum, where they focus on the following:  Custom visual creation, API usage, real-time dashboards, integrating with Power BI, content packs. Basically, everything about extending Power BI.


https://community.fabric.microsoft.com/t5/Developer/bd-p/Developer

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.