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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
roger360
Frequent Visitor

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?


2 ACCEPTED SOLUTIONS
Sahir_Maharaj
Super User
Super User

Hello @roger360,

 

Can you please try this approach:

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

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

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

AverageNumberOfQuestions = AVERAGE(TrackerData[Number of questions])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

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

AverageNumberOfQuestions = AVERAGE(TrackerData[Number of questions])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Ah you're right! did overthinking. Thanks

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Sahir_Maharaj
Super User
Super User

Hello @roger360,

 

Can you please try this approach:

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

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Thats perfect @Sahir_Maharaj ...thanks.

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

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.