Forum Discussion

sariaz's avatar
sariaz
Icon for Microsoft Employee rankMicrosoft Employee
5 years ago

Creating power BI dashboard based on different Job ids

Hi,

I am trying to see if this requirement can be full filled using power bi.

We have a pipeline where users can upload their script. Once the script is uploaded other users can run then when required. Each run of the script creates a jobid and raw data. The rawdata is stored in a table whose name is same as job id.

Now the goal is along with raw data user should also see some dashboard created using the raw data. So bascially when we onboard a script we can as user to provide a templatized dashboard which just needs to fetch data from a table based on the job id.

 

We are using pulse for dashboard purpose currently which provides a solutioin where any time user clicks on the job id we pass the job id in the URL for the pulse dashboard link. The pulse dashboard reads from the URL the job id and fetches the data. Example code below. We want to move out of pulse and move to power bi. Is this something feasible in power bi where it will read data from different tables based on the run time input?

 

declare @tablename nvarchar(200)
set @tablename = N'[' + @jobid + N'_Analysis]'
 
declare @t nvarchar(4000)
set @t = N'
if not exists(select top 1 1 from ' + @tablename + ')
begin
Select ''No data found for this segment'' as ErrorMessage
end
else
begin
SELECT
* from ' + @tablename + '
end'
exec sp_executesql @t

2 Replies