Forum Discussion

roger360's avatar
roger360
Frequent Visitor
1 year ago
Solved

Getting syntax error when calculating average

Wherever I try incorporating a calculation with excluding blanks, I get Syntax error. Quite frustrating!

 

For instance- I am trying to calculate average of a clumn which has number of questions asked during a call. The column has blank cells as well. The formula I tried for the new measure is:

 

AverageNumberOfQuestions =
CALCULATE(
    AVERAGE(TrackerData[Number of questions]),
    NOT(ISBLANK(TrackerData[Number of questions]))
)

 
I am getting the following error message-
The following syntax error occurred during parsing: Invalid token, Line 3, Offset 3,  .

FYI: I checked the column heading and everything looks good.



Why am I getting this and how to resolve it?


  • Hello roger360,

     

    Can you please try this approach:

    AverageNumberOfQuestions =
    CALCULATE(
        AVERAGE(TrackerData[Number of questions]),
        FILTER(
            TrackerData,
            NOT(ISBLANK(TrackerData[Number of questions]))
        )
    )
    
  • Hi,

    Blanks do not impact an average calculation.  This simple measure should work

    AverageNumberOfQuestions = AVERAGE(TrackerData[Number of questions])

    Hope this helps.

5 Replies

  • Hello roger360,

     

    Can you please try this approach:

    AverageNumberOfQuestions =
    CALCULATE(
        AVERAGE(TrackerData[Number of questions]),
        FILTER(
            TrackerData,
            NOT(ISBLANK(TrackerData[Number of questions]))
        )
    )
    
    • roger360's avatar
      roger360
      Frequent Visitor

      Thats perfect Sahir_Maharaj ...thanks.

      Do you mind giving me a quick reason why my previous one showing that error? 

  • Hi,

    Blanks do not impact an average calculation.  This simple measure should work

    AverageNumberOfQuestions = AVERAGE(TrackerData[Number of questions])

    Hope this helps.