Forum Discussion

F_Reh's avatar
F_Reh
Icon for Post Patron rankPost Patron
1 year ago
Solved

SPC Chart Error - Cannot Read Properties of Null (reading 'length')

Good Afternoon,

 

I am using an SPC control (which I have imported in)....When I assign fields to both Outcome/Numerator and ID Key (Date) there is no problem. But when I add the Indicator-signifying field  - which is of Text type - to Grouping (Summary Table) I get the following error:

 

"Cannot Read properties of null (reading 'length')

 

 

Kindly advise how I can resolve this.

 

Regards

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi F_Reh ,

    This error message in Power BI, "Cannot read properties of null (reading 'length')," typically occurs when the code is trying to access the length property of a variable that is null or undefined.

     

    I think you can do these things following:

     

    1. Ensure that all data sources are correctly connected and that there are no null values where the code expects data.

     

    2. Review your DAX expressions to ensure they handle null values properly. You might need to use functions like IF, ISBLANK, or COALESCE to manage null values.

     

    3. You can also refer to the official SPC Chart documentation:

    Business Apps – Microsoft AppSource

     

     

    Best Regards

    Yilong Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi F_Reh ,

    This error message in Power BI, "Cannot read properties of null (reading 'length')," typically occurs when the code is trying to access the length property of a variable that is null or undefined.

     

    I think you can do these things following:

     

    1. Ensure that all data sources are correctly connected and that there are no null values where the code expects data.

     

    2. Review your DAX expressions to ensure they handle null values properly. You might need to use functions like IF, ISBLANK, or COALESCE to manage null values.

     

    3. You can also refer to the official SPC Chart documentation:

    Business Apps – Microsoft AppSource

     

     

    Best Regards

    Yilong Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • F_Reh's avatar
    F_Reh
    Icon for Post Patron rankPost Patron

    I tried Coalesce function but it did not rectify the issue. The field used for Grouping (Summary Table)  is called 'Data Records'[Outcomes] is actually of Text type (perhaps that was the cause of the issue when used in conjunction with Coalesce ?).  

     

    I have more or less resolved the issue now as follows:

     

    By creating a new calculated column with the following expression:  

     
    Outcomes = IF(ISBLANK('Data Records'[Outcomes]),"N/A",'Data Records'[Outcomes])
     
    Which removes the NULLs.
     
    And for ID Key (Date), instead of using the actual field Month_year, I used the Date hierarchy for it i.e  Year, Quarter, Month and Day.  I am intrigued to comprehend why the issue persists when using Month_Year on its own.
     

     

     

     

    Regards