Forum Discussion

sdjelal's avatar
sdjelal
Regular Visitor
4 years ago
Solved

Query a API based on cell value and load response

I have an existing workbook which has both number/epoch dates and text. Based on the number in each row, I am looking to query an API that returns the subsequent columns. However, I want to return on...
  • v-jingzhang's avatar
    v-jingzhang
    4 years ago

    Hi sdjelal 

     

    Thank you for explaining. The Figure 3 is only for one ID, right? Based on Figure 3, you can first extract date from schedule column by converting it to date data type or adding a new column to get dates. 

     

    Then convert this query into a custom function with id as a parameter. Add "(id as number)=>" on the first row and replace the static id number with the parameter id. 

     

    Prepare another table which has all IDs in a column. Go to Add Column > Invoke Custom Function, under Function query box, select the function query created in previous step. And select id column to provide data for the id parameter. This will bring you a new table column. It will invoke the custom function for every row. After that, expand the table column to have reward and schedule values for all IDs. 

     

    Then you can apply the data, go to Power BI Desktop and use Matrix visual to display the result. Put ID on rows and date on columns. Put reward in Values well and select a proper aggregation type for it. 

     

    Hope this is helpful. 

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.