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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
schwinnen
Helper V
Helper V

There is not enough memory to complete this operation

I have received this error and I have read some other threads on this, but none of them apply to my situation.  I have narrowed it down to one specific formula that is causing this error.  This is that formula:

ROUTE MEASURE = 
VAR MinTrips = 5 // Set the minimum number of trips to be considered here
VAR MaxRank = 10 // Set how many different destinations to include in the ranking here
VAR FilteredQA =
    FILTER (
        ADDCOLUMNS (
            VALUES ( QA[ROUTE] ),
            "Number of Trips", CALCULATE (
                COUNTROWS ( QA )
            ),
            "Ranking", CALCULATE (
                RANKX (
                    ALL ( QA[ROUTE] ),
                    AVERAGE ( QA[TIME AT ORIGIN] ),
                    ,
                    DESC, //change to ASC if you want the lowest average time to be #1 rank
                    SKIP
                )
            )
        ),
        [Number of Trips] >= MinTrips
            && [Ranking] <= MaxRank
    )
RETURN
    CALCULATE (
        AVERAGE ( QA[TIME AT ORIGIN] ),
        FilteredQA
    )

 

Now, someone on these forums helped me create that formula so that I could display only routes with at least 5 trips.  Actually, it is incorrect for me to say that the above formula was created for that purpose.  The formula below was created for that purpose and the formula below actually works just fine.  My only hypothesis is that the formula below is ranking Origins by Average Time at Origin, which are related fields, wheras the formula above is attempting to rank Route by Average Time at Origin and since these fields are unrelated, the program is taking up a lot of memory trying to figure out this calculation?  I could be way off base here, but I am posting this here to see if anyone else has a guess as to what might be causing this.

 

ORIGIN MEASURE = 
VAR MinTrips = 5 // Set the minimum number of trips to be considered here
VAR MaxRank = 10 // Set how many different destinations to include in the ranking here
VAR FilteredQA =
    FILTER (
        ADDCOLUMNS (
            VALUES ( QA[ORIGIN] ),
            "Number of Trips", CALCULATE (
                COUNTROWS ( QA )
            ),
            "Ranking", CALCULATE (
                RANKX (
                    ALL ( QA[ORIGIN] ),
                    AVERAGE ( QA[TIME AT ORIGIN] ),
                    ,
                    DESC, //change to ASC if you want the lowest average time to be #1 rank
                    SKIP
                )
            )
        ),
        [Number of Trips] >= MinTrips
            && [Ranking] <= MaxRank
    )
RETURN
    CALCULATE (
        AVERAGE ( QA[TIME AT ORIGIN] ),
        FilteredQA
    )
3 REPLIES 3
GilbertQ
Super User
Super User

Hi there

Would it be possible to post some sample data with your above issue?

It would make the process a lot easier.

Also how large is your table 'QA'

It would appear that possibly it has to load the entire table into memory to complete the calculation, which could cause the out of memory errors.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

I'm using a PostgreSQL database so it's not really possible to post sample data.  Even if I could, it would not be worth the time it would take to make the data anonymous.  

I found a way to not use that formula, however, I would still be interesting in knowing why this is happening.  

The QA table is quite large, over 50 columns once all the formulas are taken into account.  Nevertheless, I refresh the data all the time with no issues.

Hi there

No worries, what it would appear is that it is trying to load the entire table and then only filtering based on your variables.

I would look at a way to limit the rows returned for your columns "Number of Trips" and "Ranking"

What I have done in the past is to create a calculated table which would just create a table for "Number of Trips" and find a way to reduce the rows returned. If you had to copy the code now into a calculated table, you would be able to see how many rows are in the table. And then work back from there?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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