Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

How to change Power BI source using parameter

Hello,
I have a report which should be produced by different users simultaneously for different clients.
the report should be based on temporary tables in SQL that retrieves the relevant data for each user logged in to the application
my goal is to change the source of the component in Power BI using parameter which is contains the user name (from query).
I need to concatenate the username parameter to the end of the table name.

let
Source = Sql.Database("pgwmdb01", "PMS"),
dbo_PBIBalances = Source{[Schema="dbo",Item="PBIBalances"]}[Data],
result = if (UserName="") then dbo_PBIBalances else Text.Combine("PBIBalances",UserName)
in
result


for example:
"PBIBalances" should be replaced by "PBIBalances_Ziva"
I'm not familiar with Power BI coding, but tried to use function text.combine to concatenate the parameter with the table name, but I get an error.
Expression.Error: We cannot convert the value "PBIBalances" to type List.
Please your advice how can I solve this issue or if there is any other way to achieve this.

Thanks,