Forum Discussion

Pawel_1990's avatar
Pawel_1990
Icon for Helper I rankHelper I
1 year ago
Solved

Error on Service - Works on Desktop - We're sorry, an error occurred during evaluation

On whole workspace, after midnight parts of reports stopped working correctly. Nothing was changed in reports (some were aumatically refreshed for last few months).

Source of data - SnowFlake

Random visuals are returning issue:  We're sorry, an error occurred during evaluation.;Object reference not set to an instance of an object. Object reference not set to an instance of an object.



When checked visual by visual it made no sense - two different measures, one "count" - thorwing error second "distinctcount" - working. 

To make it even more confusing on desktop everything works correctly, only when published to Workspace issues are showing. 

Can someone help and advice how this can be fixed? 

  • Hi Pawel_1990 , Thank you for reaching out to the Microsoft Community Forum.

     

    Microsoft recently introduced stricter runtime evaluation for DirectQuery sources like Snowflake. Visuals now fail when nulls or unexpected structures are returned at runtime, issues that were previously handled silently.

     

    Your reports haven’t changed, but Power BI Service has. If Snowflake returns a null, an empty join, or altered structure, measures like COUNT([Column]) can now throw errors, while others like DISTINCTCOUNT may still work. To avoid this, wrap measures to handle nulls explicitly.

     

    If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.

4 Replies

  • v-hashadapu's avatar
    v-hashadapu
    Icon for Community Support rankCommunity Support

    Hi Pawel_1990 , Thank you for reaching out to the Microsoft Community Forum.

     

    Microsoft recently introduced stricter runtime evaluation for DirectQuery sources like Snowflake. Visuals now fail when nulls or unexpected structures are returned at runtime, issues that were previously handled silently.

     

    Your reports haven’t changed, but Power BI Service has. If Snowflake returns a null, an empty join, or altered structure, measures like COUNT([Column]) can now throw errors, while others like DISTINCTCOUNT may still work. To avoid this, wrap measures to handle nulls explicitly.

     

    If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.

    • Pawel_1990's avatar
      Pawel_1990
      Icon for Helper I rankHelper I

      This comment helped me to find solution. There are two options:
      - rewrite DAX code / Power Query steps to be clean. Check some data types (they like to get messed up in my case)
      - other way is to switch [implementation =2.0] at Power Query code level to =1.0 or remove it (it may also mess some data types so check it as well) 

    • SPPBI's avatar
      SPPBI
      New Member

      I'm having the same problem despite using DistinctCount. Is there a document that shows how to handle this?

      Pct_BillAging_90Plus = 
      DIVIDE(
          CALCULATE(
              DISTINCTCOUNT(BILLING_DETAIL[HEADER_ID]),
              NOT(ISBLANK(BILLING_DETAIL[BILL_AGING])),
              BILLING_DETAIL[BILL_AGING] >= 90,
              BILLING_DETAIL[BALANCE] > 0
          ),
          CALCULATE(
              DISTINCTCOUNT(BILLING_DETAIL[HEADER_ID]),
              NOT(ISBLANK(BILLING_DETAIL[BILL_AGING])),
              BILLING_DETAIL[BALANCE] > 0
          )
      )

       This is my DAX for example. 

      • v-hashadapu's avatar
        v-hashadapu
        Icon for Community Support rankCommunity Support

        Hi SPPBI , Thank you for reaching out to the Microsoft Community Forum.

         

        Logic like NOT(ISBLANK(...)) outside of FILTER() can cause runtime failures when columns contain nulls or the query doesn’t fold cleanly. That’s why you're seeing “Object reference not set...” errors, even though the report hasn’t changed.

         

        To fix it, move all conditions into FILTER() to ensure stable query translation. Example:

        Pct_BillAging_90Plus =
        DIVIDE(
        CALCULATE(
        DISTINCTCOUNT(BILLING_DETAIL[HEADER_ID]),
        FILTER(
        BILLING_DETAIL,
        NOT ISBLANK(BILLING_DETAIL[BILL_AGING]) && BILLING_DETAIL[BILL_AGING] >= 90 &&
        BILLING_DETAIL[BALANCE] > 0
        )
        ), CALCULATE(
        DISTINCTCOUNT(BILLING_DETAIL[HEADER_ID]),
        FILTER(
        BILLING_DETAIL,
        NOT ISBLANK(BILLING_DETAIL[BILL_AGING]) &&
        BILLING_DETAIL[BALANCE] > 0
        )
        )
        )

         

        Please refer to the below documentation:

        DirectQuery model guidance in Power BI Desktop - Power BI | Microsoft Learn

        Lesson Learned #524: Optimizing Power BI with DirectQuery | Microsoft Community Hub

        DirectQuery in Power BI - Power BI | Microsoft Learn

         

        If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
        Thank you.