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.
The Power Query function Date.AddDays() function does not function in the March 2020 PBI update when applying it to the results from a Kusto (Azure Data Explorer) connection query. I have several queries that pull data from Kusto, and then have to add 1 day to the Date column because PBI is flooring() the Date column when extracting 'Date Only' and rounding it down a day, and all of these queries broke in multiple PBI reports after installing the March 2020 update.
I've found a work around to just add +duration(1,0,0,0) rather than using Date.AddDays(), but this is a bit obnoxious as I have to go update it in multiple PBI files, and I'm concerned for the reports I don't get to if the workspace will ingest this error down the road.
Error contents:
Bad request: Request is invalid and cannot be executed.
Details:
Error=Syntax error: Query could not be parsed: SYN0002: A recognition error occurred. [line:position=3:46]. Query: '[redacted Kusto Query]
| limit 1000
| extend ["Date.1"]=(floor(["Date"], 1d) + 1.0d)'
Code=General_BadRequest
x-ms-activity-id=49d5791d-6df0-413d-a526-81fd002800dc
x-ms-client-request-id=KPBI;be1a2709-2afb-4cdd-926d-1d3d3d7b0570;d88b712e-17e1-4837-a94b-a5f5b6a7cba7
I've recreated this now with multiple Kusto queries in brand new PBI files.
Repro Steps:
1. Create an Azure Data Explorer query connection
2. Pull a dataset that includes a column with timestamps
3. Add Column - Press the 'Date' drop-down menu on the 'Add Column' ribbon option and select 'Date Only'
Note: Using the 'Date Only' option from the 'Add Column' ribbon names the new column [Date] in step 3.
4. Either update the newly added column to be wrapped in the Date.AddDays() function:
or else add a new custom column that is defined as
Results:
PBI errors out when trying to add 1 day to the [Date] column. It appears to be trying to add a 1.0d instead of a 1d when performed this way, and I don't believe you can add decimaled dates, so I'm guessing it's the changing of the datatype to now be using a double instead of an integer for the added day count that is breaking it.
Full Power Query:
let
Source = Kusto.Contents("clustername", "Database", "QueryText", [MaxRows=null, MaxSize=null, NoTruncate=null, AdditionalSetStatements=null]),
#"Inserted Date" = Table.AddColumn(Source, "Date.1", each Date.AddDays(DateTime.Date([Date]), 1), type date)
in
#"Inserted Date"
Hi @CHohnbaum ,
We can use calculated column like that to work around.
Column = 'Product'[SalesDate] +1
Please file a support request with the Power BI team at this link. You've done some good research, but this is a community support forum and it won't likely be seen by a Power BI dev as fast as the support link will.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingCovering 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.