Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have taken data from ODBC Bigquery DSN and trying to add a query over it. The query works fine when I give it fixed date values for the date range.
However It doesn't work when I am trying to add a Date Parameter to it to dynamically change the date range.
Here is how I have defined my date paramater.
and here is the query for the odbc data source:
Odbc.Query("dsn=Google BigQuery", "#(lf)SELECT#(lf) DISTINCT #(lf) client_id,#(lf) domain,#(lf) company, #(lf)FROM#(lf) `bq_project.bq_dataset.bq_table` #(lf)WHERE#(lf) FORMAT_DATE('%d/%m/%Y', date) <= '" &endDate& "'#(lf) and source != 'direct'#(lf) and not REGEXP_CONTAINS(source, 'paypal' )#(lf) AND DATE >= '2020-12-16'")
It returns Expression.Error: We cannot apply operator & to types Text and Date.
Please note that the datatype of date column in the datasource is date and not text.
Not sure what am I doing wrong here. Please help me with it.
Solved! Go to Solution.
@hussain_onmodus , the issue has nothing to do with the dataset; but only with your M code. It seems the data type of endDate is date. You might want to try to subsitute your orignal code &endDate& with & Date.ToText(endDate, "ddMMyyyy") &
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@hussain_onmodus , the issue has nothing to do with the dataset; but only with your M code. It seems the data type of endDate is date. You might want to try to subsitute your orignal code &endDate& with & Date.ToText(endDate, "ddMMyyyy") &
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |