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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ftglobecrawler
New Member

Skip Sum Computation when Power BI interprets column as string

We are working with a live connection (to an Excel sheet) which makes it impossible to modify the data, I tried my best to clean up the source. I have the problem, that I have an empty column which is interpreted as STRING instead of numbers and therefore I cannot build the SUM. I try to skip the computation of the sum with an if command when the cells are empty, but it does not work.

 

This is the basic function I try to work with:

 

New Total  =
if (
    COUNT(List_A[Column A]) < 1,0,5)
 
It works that I get "0" if ther are no values, and I would get 5 if there are 2 or more values.
 
Now I repalce the "5" with the SUM command:
New Total  =
if (
    COUNT(List_A[Column A]) < 1,0, SUM(List_A[Column A]))
 
The value is not computated and Power BI complains that the SUM command is not possible to be executed as it is a string.
 
Anyone can help? I'm a bit confused, why does Power BI even bother about the SUM command if the if function tells it to skip it? 
1 ACCEPTED SOLUTION
Sahir_Maharaj
Super User
Super User

Hello @ftglobecrawler,

 

Can you please try:

 

1. Convert Strings to Numbers

New Total = 
IF (
    COUNT(List_A[Column A]) < 1,
    0,
    SUMX(List_A, VALUE(List_A[Column A]))
)

 

2. Handle Non-Numeric Values

New Total = 
IF (
    COUNT(List_A[Column A]) < 1,
    0,
    SUMX(List_A, IF(ISNUMBER(VALUE(List_A[Column A])), VALUE(List_A[Column A]), 0))
)

 

Should you require further assistance, please do not hesitate to reach out to me.


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: 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

1 REPLY 1
Sahir_Maharaj
Super User
Super User

Hello @ftglobecrawler,

 

Can you please try:

 

1. Convert Strings to Numbers

New Total = 
IF (
    COUNT(List_A[Column A]) < 1,
    0,
    SUMX(List_A, VALUE(List_A[Column A]))
)

 

2. Handle Non-Numeric Values

New Total = 
IF (
    COUNT(List_A[Column A]) < 1,
    0,
    SUMX(List_A, IF(ISNUMBER(VALUE(List_A[Column A])), VALUE(List_A[Column A]), 0))
)

 

Should you require further assistance, please do not hesitate to reach out to me.


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: 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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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