March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I would like to build reports based on information contained in tables on a sql server. The sql server contains multiple tables (one for each datatype).
I have written this function in power query :
let
GetTableFromDataBase = (schema as text, id_file as text, tablename as text) => let
Source = Sql.Database("xxx.database.windows.net", "xxx", [Query="SELECT * FROM "&schema&"."&tablename&" WHERE [id_file]="&id_file])
in
Source
in
GetTableFromDataBase
Then i invoked the function on a query containing 3 collumns (schema,id_file,tablename) to get each table that i need but this steps gives me this warning message:
"Step results in a query not supported in DirectQuery Mode"
Is there any way to do this without losing the DirectQuery Mode?
EDIT:
EDIT:
I tried some other ways to make dynamic import using directquery, this query (using parameters) is supported in DirectQuery:
let
Source = Sql.Database(ServerAdress, DbName),
GoTable = Table.SelectRows(Source{[Schema=schema,Item=tablename]}[Data],each [id_file]=id_file)
in
GoTable
But if i take the same query and convert it to a function then call it using the same parameters PowerBi switches to import mode, this is a simple query why wouldn't it be DirectQuery compatible?
Thanks.
Thanks.
Hi @Anonymous ,
Please refer to this post to ensure that your tables remained in DirectQuery mode.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I edited the issue, the solution might be not calling custom functions?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
16 | |
13 | |
12 | |
9 |
User | Count |
---|---|
36 | |
31 | |
20 | |
19 | |
17 |