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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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