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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
maxbradley
Frequent Visitor

Not enough memory error when using a calculate function.

I'm trying to calculate the percentile of a value, so dividing a count of the values lower than the row value by a total count of the values. However, the dataset has multiple years, and I want the percentiles to be calculated only within their own year. The code I'm using is;

 

AttendancePercentile =
VAR Position =
[Attendance]
VAR Acayear =
[time_period]
Return
CALCULATE(COUNTROWS('1_absence_3term_geography'),
FILTER('1_absence_3term_geography',
[Attendance]<=Position &&
[time_period]=Acayear
)
)
 
And this is producing the error;
<pi>There's not enough memory to complete this operation. Please try again later when there may be more memory available.</pi>
 
The table has 22 columns and 23,717 rows, so not small but by no means the largest I've worked with, which makes me suspect that there is some sort of loop in the DAX code causing the computing process to drop down a rabbit hole. Do you see anything wrong with the above formula, and if not, what further steps can I take to diagnose my memory issue?
 
Thanks in advance
1 ACCEPTED SOLUTION

Thanks a lot for your help.

 

Just for anyone who has the same issue, the solution that worked for me is a little embarassing; Update PBI.


I'll also follow your advice to see if I can streamline the process as well.

 

Best,

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi  @maxbradley ,

You can try the following methods:

Could have to do with how you have you data model created in Power BI.

1. You can use Dax Studio to check, use the following link to do it, Find your longest running queries and analyze them.

https://www.pbiusergroup.com/communities/community-home/digestviewer/viewthread?MessageKey=6cd37af6-...

2. Also related to the format of the datetime:

https://www.pbiusergroup.com/communities/community-home/digestviewer/viewthread?MessageKey=aa5e34b8-...

3. Try disabling ‘Auto date/time’ under Options > Data Load > Time intelligence.

Or

Another way is to go to "Data Cache Management Options" and clear the cache or increase the "Max Allowed" number.

vyangliumsft_0-1652850241600.png

 

This is the related document, you can view this content:

https://community.powerbi.com/t5/Desktop/There-s-Not-Enough-Memory-To-Complete-This-Operation/td-p/3...

https://blog.magnetismsolutions.com/blog/colinmaitland/2019/02/05/power-bi-desktop-memory-issue-reso...

https://blog.magnetismsolutions.com/blog/colinmaitland/2019/02/05/power-bi-desktop-memory-issue-reso...

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot for your help.

 

Just for anyone who has the same issue, the solution that worked for me is a little embarassing; Update PBI.


I'll also follow your advice to see if I can streamline the process as well.

 

Best,

SpartaBI
Community Champion
Community Champion

@maxbradley is that a calculated column. If yes, then try this instead:

 

 

AttendancePercentile =
VAR Position = [Attendance]
VAR Acayear = [time_period]
RETURN
    COUNTROWS (
    	FILTER (
        	'1_absence_3term_geography',
        	[Attendance] <= Position
            	&& [time_period] = Acayear
    	)
    )

 

 


2022-05-09 21_46_30-Auto sign in click on _Sign-in_ if button appears ... - Microsoft Power BI Commu.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png  SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors