Reputation: 9664
I have added SQL data source. Then, instead of selecting the table I have typed the following query:
SELECT ID, NAME, AGE
FROM STUDENTS
When I right click on the step then I see that the native query option is disabled. Why does adding simple SQL query as Power BI data source prevent native query folding? Is native query only supported if I select the table via UI and then select the transformations?
Upvotes: 2
Views: 166
Reputation: 30174
You can enable query folding with a native query. There is an excellent article by Chris Webb where he describes all the details.
EDIT: CODE ADDED
let
Source = Sql.Databases("localhost"),
AdventureWorksDW2017 = Source
{[Name = "AdventureWorksDW2017"]}
[Data],
RunSQL = Value.NativeQuery(
AdventureWorksDW2017,
"SELECT EnglishDayNameOfWeek FROM DimDate",
null,
[EnableFolding = true]
),
#"Filtered Rows" = Table.SelectRows(
RunSQL,
each (
[EnglishDayNameOfWeek] = "Friday"
)
)
in
#"Filtered Rows"
Upvotes: 3