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
Anonymous
Not applicable

SUMX not working as intended

Hello,

 

I have a matrix with 3 levels: Lane (shipping route), Shipment #, Material.

 

I want to show total # of loads on each Lane, and then show the # of loads below 85% utilization for that Lane.

I have a column called '<85%' that is either 1 or 0, based on utilization of each shipment #. I can't just use SUM on that column, since I have another level in the matrix (material), causing the shipment # to have as many records as there are unique material on that truckload (see the '<85%' column). I tried using MAX and SUMX, which is working at the shipment # level, but the aggregation for the Lane-level is not working. It should be 5, not 2. Sorry if this is confusing. Any help is appreciated!

 

test = IF(ISINSCOPE('Pivot Data'[Shipment Number]),
            MAX([< 85%]),
            SUMX(VALUES('Pivot Data'[< 85%]), MAX('Pivot Data'[< 85%])))

 

djwitkowski_1-1664289025584.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Not very clear. It should be like

 

test = Sumx('Pivot Data'[Shipment Number]),calculate(MAX([< 85%])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Not very clear. It should be like

 

test = Sumx('Pivot Data'[Shipment Number]),calculate(MAX([< 85%])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak thank you, this worked! I still needed to use IF(ISINSCOPE(... but your solution was very helpful. 


Can you explain why I needed to use CALCULATE before MAX, rather than just using max? Thanks!

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.