Showing results for 
Search instead for 
Did you mean: 
Solution Sage
Solution Sage

How to optimize cacluation to reduce memory use?

Hi all,


I'm writing a calculated column for ranking that's giving me the standard "There's not enough memory to complete this operation. Please try again later when there may be more memory available." message.


I have two versions, one referencing a measure, one with the measure built into the calculation as a VAR. Both are having the same issue.


rank = 
VAR x = 
CALCULATE(SUM('Sales'[Sales Quantity])) /
CALCULATE(SUM('Sales'[Sales Quantity]),ALL('Sales')) RETURN rankx( all('Product'), x)


The Sales table has about 7M rows, the Product table only 400. I'm running 20GB of memory on this machine, so I've never had any memory issues before with loading or refreshing data, or creating caluations. Any tips?


Resident Rockstar
Resident Rockstar



I suggest you could create a calculated column with 


CALCULATE(SUM('Sales'[Sales Quantity])) / 
CALCULATE(SUM('Sales'[Sales Quantity]),ALL('Sales'))

then create the rank measure to optimize the calculation.  you could have a try.


In addition, you could have a reference of this similar thread to get other tips.


Best  Regards,


Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

User Groups Public Preview

Join us for our User Group Public Preview!

Power BI User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

March Update

Check it Out!

Click here to read more about the March 2021 Updates!


The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.