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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
PWRBI
Frequent Visitor

Countrows with Sumx not working

Hi guys,
I have the following data

 

StorageBoxpackageweight
AA1A10130
AA1A10220
AA2A201

40

AA2A202

30

 

Storage A has a capacity of 70. Now I would like to display in an additional table how many boxes in warehouse A still have free capacity. In the above example, this would be box A1 because 20 are still free, A2 is full with 70.

 

StorageFree boxes
A1

 

This is my Measure:

 

MEASURE =

VAR VAR1 = CALCULATE( SUMX( SUMMARIZE('STORAGE', STORAGE[STORAGE], STORAGE[BOX], "SCORE", sum(STORAGE[WEIGHT]), [SCORE] ))
VAR VAR2 = COUNTROWS(FILTER(DISTINCT(STORAGE[BOX]), VAR1< 70))

return VAR2

 

It works when I look at the box level, but when I want the total across all Storages, nothing shows up, so the total row doesn't match. What do I have to change?

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @PWRBI 
Please try

MEASUR =
SUMX (
    VALUES ( STORAGE[BOX] ),
    INT ( CALCULATE ( SUM ( TORAGE[WEIGHT] ) ) < 70 )
)

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @PWRBI 
Please try

MEASUR =
SUMX (
    VALUES ( STORAGE[BOX] ),
    INT ( CALCULATE ( SUM ( TORAGE[WEIGHT] ) ) < 70 )
)
PWRBI
Frequent Visitor
PWRBI
Frequent Visitor

Thank you very much!!! 🙂 It works😍

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.