Forum Discussion

sujeesh's avatar
sujeesh
Helper I
6 years ago
Solved

How to pass a value from one table iteratively to another API request in power bi

Hi, I am a newbie to power bi. I have a requirement to pass a value from one table iteratively to another API request query string. Output all the iteration results in a table along with a new colum...
  • Jimmy801's avatar
    6 years ago

    Hello sujeesh 

     

    you have to use a custom function for this. Create a table with your IDs, and then apply your custom function on a new column, passing the ID as parameter. I prepared for you a code example (not applying your API quering steps though). You have to put all your code here using "id" instead of your hardcoded one

    let
    	Source = #table
    	(
    		{"Release_ID"},
    		{
    			{"473"},	{"523"},	{"456"},	{"654"},	{"321"}
    		}
    	),
        QueryAPI = (id)=>
        let 
            //YourStepsGoHere
            // your reading function here("https://vsrm.dev.azure.com/fe-tfs/Advisory%20products/_apis/Release/releases/" & id &"?api-version=5.1-pre..."
        in 
            id,
    
        AddColumn = Table.AddColumn
        (
            Source,
            "QueryQuery",
            each QueryAPI([#"Release_ID"])
        )
    
    in
    	AddColumn

    Copy paste this code to the advanced editor in a new blank query to see how the solution works.

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy