Forum Discussion

svorsatzatWCG's avatar
svorsatzatWCG
New Member
3 years ago

Use table value from one page as a parameter to a Web API call on a different page

Hi All

 

I have two pages in PowerBI desktop. The first page has a table visualization that lists training campaigns (see below). The column pst_id is the unique identifier for a specific campaign.

 

NameStart Datepst_id
Baseline Test 20232023/06/14 07:251190275
Security Hints and Tips Clone2022/07/26 08:15787668
First Baseline Phishing Test2019/07/10 09:0076849

 

I want the user to be able to select a row in this table visualization and either click a button, use drillthrough or whatever you recommend is best in Power Bi for this scenario. This user action must take them to the second page, which also has a table visualization that lists all the employees who is part of this selected training campaign as per below.

 

NameSurname
TonyStark
SteveRogers
PeterParker
StephenStrange
BruceBanner
Natasha Romanoff

 

The data that populates the employees table visualization is retrieved calling a web api. The below is an extract from the query. I hardcoded the value for TrainingCampaignID to test that it works, but I need the selected pst_id from the table on the first page to be assigned to TrainingCampaignID.

 

TrainingCampaignID = "1190275",
FullURL = "https://api.training.com/v1/training_tests/" & TrainingCampaignID & "/employees",
Source = Json.Document(Web.Contents(FullURL, [Headers=[Authorization="Bearer eyJ0fGeS"]])),

 

How do I accomplish this so that the user selection on the first page passes the pst_id to the second page and calls the web api to populate the table on the second page?

 

Thank you in advance for your advice.