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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
polman4
Helper I
Helper I

Sum values if another column is not blank

Hello,

 

I'm relatively new to dax and i'm trying something more complicated but i fail 😞

I have the following data:

 

 ProductAvailableSold
1Product_1  109
2Product_1660
3Product_14538
4Product_2480
5Product_2410
6Product_35429
7Product_34527
8Product_3170
9Product_3159

 

What i would like to do is:

Check if there any value in column sold greater than zero.

If yes then sum all 'available' by product.

ProductAvailable (sum)
Product_1  121 (10+66+45)
Product_20 or null
Product_3131 (29 + 27 +10 +9)

 

I tried the following

 

 

sumif = 
    var __table = 
        FILTER('data$',
        [Sold] <> 0
)
return
sumx(__table,[Available])

 

 

but i only get the sum of the rows that are non zero (rows: 1, 3, 6, 7 and 9)

 

What i'm missing?

 

Thank you!

Grigoris

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @polman4 

please use

sumif =
IF ( SUM ( 'data$'[Sold] ) > 0, SUM ( 'data$'[Available] ) )

View solution in original post

2 REPLIES 2
polman4
Helper I
Helper I

Thank you! Works great

tamerj1
Super User
Super User

Hi @polman4 

please use

sumif =
IF ( SUM ( 'data$'[Sold] ) > 0, SUM ( 'data$'[Available] ) )

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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