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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
➤ Email: [email protected]
➤ 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
➤ Email: [email protected]
➤ 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
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.