Forum Discussion
Direct Query + Snowflake resulting in queries with cast as date for every unique date
Thanks for the response.
I've read about Value.NativeQuery and tried to apply this to the Power Query configuration of my Snowflake connexion. Here's the full code in the Advanced Editor. I have no other steps, all other data processing steps are made in DAX calculated measures.
let
Source = Snowflake.Databases("XXXX","WH_XXXX"),
DB_XXXX = Source{[Name="DB_XXXX",Kind="Database"]}[Data],
SCHEMA_XXXX = DB_XXXX{[Name="SCHEMA_XXXX",Kind="Schema"]}[Data],
MY_TABLE = SCHEMA_XXXX{[Name="MYTABLE",Kind="Table"]}[Data],
SqlStatement = "SELECT * FROM DB_XXXX.SCHEMA_XXXX.MYTABLE",
NativeQuery = Value.NativeQuery(MY_TABLE, SqlStatement, null, [EnableFolding=true])
in
NativeQuery
However, when I apply this, I get the following error
Expression.Error: Native queries aren't supported by this value.
Details:
[Table]
Do you know what would cause this error?
Secondly, I also checked all my DAX measures so that when dates are filtered, it is done with ">=" instead of using "IN {range}". None of my DAX measures had an "IN {range}" statement.
Here is one of my DAX measures, maybe I'm not seeing something?
- lbendlin2 years agoSuper User
You need to run your native query against the database, not the table.
- aangers2 years agoRegular Visitor
Sorry I misunderstood how to apply the Value.NativeQuery. Here is how I managed to bypass this error :
= Value.NativeQuery(Snowflake.Databases("XXXX","WH_XXXX"){[Name="DB_XXXX"]}[Data], "SELECT * FROM ""SCHEMA_XXXX"".""MYTABLE""", null, [EnableFolding=true])
However, the problem persists, the queries sent to snowflake still have the "cast as date"... Do you know how to control the queries that are created and sent to Snowflake from DAX calculated measures?
- lbendlin2 years agoSuper User
See if you can use dynamic M Query parameters.
Chris Webb's BI Blog: Using Power BI Dynamic M Parameters In DAX Queries (crossjoin.co.uk)
Passing Any Arbitrary Value From A Power BI Report To A Dynamic M Parameter (crossjoin.co.uk)