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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Mohamed_59
Helper I
Helper I

M Language - Need to query an API with a List of values as parameter

Hello guys,

I hope you're doing well.

I'm struggling about a code in Power Query.

Basically, what I want is to query an API with a list (named list_id) as a parameter.

 

Let's consider the following code :

Mohamed_59_5-1697199880261.png

 

It works pretty good if I put myself an ID or a list of IDs as Parameter :

Mohamed_59_2-1697199319680.png

Mohamed_59_3-1697199345126.png

But if I put directly my list of values (List_ID) as a paramater, it didn't work :

Mohamed_59_4-1697199497795.png

I tried several things but without any success 😕

 

Can you guys give me some help please ?

 

Thank you.

 

 

 

 

 

 

1 ACCEPTED SOLUTION
ImkeF
Super User
Super User

Hi @Mohamed_59 ,
yes, that't to be expected.
The function is defined to be only working with text values as input.
What you have to do if you want to run this function on multiple values that currently sit in a list, do the following:
1) Transform the list into a table

2) add a custom column to that table where you call the function and reference the first column of the table as input for the function.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Super User
Super User

Hi @Mohamed_59 ,
yes, that't to be expected.
The function is defined to be only working with text values as input.
What you have to do if you want to run this function on multiple values that currently sit in a list, do the following:
1) Transform the list into a table

2) add a custom column to that table where you call the function and reference the first column of the table as input for the function.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Thanks for the response ImkeF !

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors