Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
CHohnbaum
Employee
Employee

Date.AddDays() Power Query after Azure Data Explorer query broken in March 2020 PBI Update

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:

  • Date.AddDays(DateTime.Date([Kusto timestamp column]), 1)

or else add a new custom column that is defined as

  • Date.AddDays([Date], 1)

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"
2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @CHohnbaum ,

 

We can use calculated column like that to work around.

 

Column = 'Product'[SalesDate] +1

 

  

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
edhans
Super User
Super User

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.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors