Forum Discussion

john_ach's avatar
john_ach
Frequent Visitor
5 years ago
Solved

Incorrect Errors in Appearing in Dataflows

Hi,

 

I have a set of dataflows which have been working and refreshing hourly for the past week. From 8pm BST yesterday (Sunday 13th June) all subsequent hourly refreshes have failed. No changes have been made to the dataflows, and I don't think any changes have been made to the originating database.

 

The error given is 'we cannot apply operator to types date and datetime', though it is noted against different entities in different dataflows depending on the specific refresh - I assume this is just due to sequencing/order of execution varying.


I have checked the specific steps noted in the errors, and they are all Date type compared with Date type. This code also worked correctly over the past ~7 days without giving the error. The error appears to be incorrect.

 

Has anyone experienced anything similar, or have any suggestions as to the cause and fix?

 

Thanks for your help

  • john_ach's avatar
    john_ach
    5 years ago

    I have discovered a workaround that seems to have removed the error, which can hopefully help some people in the short term. I don't think this should be necessary though - this seems to be a more fundamental issue in Power BI service?

     

    The workaround for me was to cast the (date type) field to a date type in the filter logic, for example:


    From 

    [Record Date] > DateTime.Date(DateTime.LocalNow())


    to

    DateTime.Date([Record Date]) > DateTime.Date(DateTime.LocalNow())


    Just to reiterate that [Record Date] field is already of Date type..

6 Replies

  • arvindsingh802's avatar
    arvindsingh802
    Community Champion

    As these were refreshing fine before, just check if source data has been updated with bad data - Time window will be same when it start failing

    Also validate if you are applying the data type change before applying the operator

     

    If this post helps, then please consider Accept it as the solution and give it a thumbs up

  • john_ach's avatar
    john_ach
    Frequent Visitor

    Thanks - I've rechecked and this is the flow structure:

    • Staging Dataflow - Loads table with DateTime column
    • Transformation 1 - Loads linked entity from the Staging Dataflow, converts column to Date type
    • Transformation 2 - Loads linked entity from Transformation 1 (column is Date type), performs > operation


    So I would think that as I cast the column to Date type it should mean that even if the source data changed it should not impact my dataflows. 

     

    An example of the error is below, in case useful
    We cannot apply operator < to types Date and DateTime. Operator = < Left = 6/14/2021 12:00:00 AM Right = 12/16/2019 12:00:00 AM.

     

    Also to note - when I view the dataflow the preview calculates correctly without any errors or warnings.

     

    Thanks for your help

  • mikesmith_bp's avatar
    mikesmith_bp
    Frequent Visitor

    I am getting the same error on a dataflow that has been running for a long time.  It began to fail early on Jun-14 and and failed everytime since.  The error message is 

    We cannot apply operator < to types Date and DateTime. Operator = < Left = 4/1/2021 12:00:00 AM Right = 10/31/2020 12:00:00 AM

    • john_ach's avatar
      john_ach
      Frequent Visitor

      I have discovered a workaround that seems to have removed the error, which can hopefully help some people in the short term. I don't think this should be necessary though - this seems to be a more fundamental issue in Power BI service?

       

      The workaround for me was to cast the (date type) field to a date type in the filter logic, for example:


      From 

      [Record Date] > DateTime.Date(DateTime.LocalNow())


      to

      DateTime.Date([Record Date]) > DateTime.Date(DateTime.LocalNow())


      Just to reiterate that [Record Date] field is already of Date type..

  • Anonymous's avatar
    Anonymous
    Not applicable

    Whenever you find weird errors appear all of the suddent to previously working dataflows, especially regarding data type conversions etc. it's this problem 9 times out of 10:

    For whatever reason, Microsoft resets privacy levels on your dataflow's data sources. If you see unexplainable errors, go to Settings and make sure that all the data sources have the same (!) privacy level. After you've done, the dataflow should refresh with no problem.

    Don't ask me why it's happening. Things work in misterious way in the cloud.