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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
cj_oat
Helper I
Helper I

SUMX not working in Matrix Table

Hi,

 

I have an issue when using SUMX to sum Measure below, however, when I put it in Matrix Table, it shows "Query has exceeded the available resources.", is there any other formula that can sum Measure (or to make below Measure to sum itself when showing Subtotal or Grand Total)

 

Active Count = SWITCH(TRUE(),[__Active]=1 && ([__Sales]>0 || [Inventory]>0),1,BLANK())
2 REPLIES 2
Kedar_Pande
Super User
Super User

@cj_oat 

Updated Measure

Active Count =
SUMX(
ADDCOLUMNS(
VALUES('YourTableName'[KeyColumn]), 
"__ActiveResult", SWITCH(
TRUE(),
[__Active] = 1 && ([__Sales] > 0 || [Inventory] > 0), 1, BLANK()
)
),
[__ActiveResult]
)

💌 If this helped, a Kudos 👍 or Solution mark ✔️would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

 

123abc
Community Champion
Community Champion

 

You could create a calculated table or a new measure that aggregates the data first and then applies the SUMX:

 
Active Count Aggregated = SUMX( VALUES('YourTable'[Category]), SWITCH(TRUE(), [__Active] = 1 && ([__Sales] > 0 || [Inventory] > 0), 1, BLANK() ) )
 

This way, you're only working with unique categories or groupings, which reduces the load.

  • Optimize the SWITCH Function: If the SWITCH function is causing heavy computation, you might want to simplify it or avoid unnecessary checks. For instance, check if it can be reduced to just one condition or if the data model could be simplified by preprocessing some calculations outside of DAX.

  • Use SUM instead of SUMX in Totals: In some cases, using SUM instead of SUMX can work better in terms of performance, particularly for totals or subtotals. However, this depends on your specific calculation.

    You can try using SUM over a simplified version of your measure:

     
    Active Count Total = SUM('YourTable'[Active Count Column])

    This approach calculates the Active Count for each row and then sums it up for subtotals and grand totals.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors