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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.