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
Chris123Terr
Frequent Visitor

Sum excluding NAs and applying a condition

I have an age column that is in text format because it has NA.
I want to add those values ​​that are greater than 50, but I need to exclude the NAs. How could I do it? Thanks.

1 ACCEPTED SOLUTION

Thanks for your Kudos and please mark my post as a solution if you like it

Mahyartf

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@Chris123Terr you can tweak the measure

 

Measure = 
CALCULATE ( 
   SUM ( IFERROR ( Table[Column] ), 0 ),
   IFERROR ( VALUE ( Table[Age] ), 0 ) > 50 
)

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

MahyarTF
Memorable Member
Memorable Member

Hi,

If I am not mistaken, you want to exclude the NA values,

In Power query you could change the datatype of the column to number then do one of belows :

1- Remove the Error rows :

MahyarTF_0-1662507853299.png

 

2- Replace the error value with nul or whatever you want :

MahyarTF_1-1662507889300.png

this is the result (for second way) :

MahyarTF_2-1662507927411.png

 

Appreciate your Kudos

Mahyartf

It's a good suggestion too. Thank you so much.

Thanks for your Kudos and please mark my post as a solution if you like it

Mahyartf
parry2k
Super User
Super User

@Chris123Terr If I remember it correct I did answer this question yesterday

 

Measure = 
CALCULATE ( 
   SUM ( Table[Column] ),
   IFERROR ( VALUE ( Table[Age] ), 0 ) > 50 
)

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes. It happens that with that DAX function I get the following error: "The Sum function does not admit values ​​of type string". This seems to me to mean that the "SUM ( athlete_events_NEW[Age] )" part of the sum, has the NA values.
On the other hand, when I do it with the "COUNTROWS" function, that problem does not happen.

Años_Distinct = CALCULATE (
SUMX ( table , IFERROR VALUE table[Age] ) , ) ) ,
IFERROR ( VALUE ( table[Age] ), 0 ) > 50
)


With this new measurement I get the correct values, but it seems very long for something so simple.

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.