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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Nimai123
Post Patron
Post Patron

Memory error

We are trying to solve the issue. We got the problem by the following DAX query on the calculated column -

 

Final 2 =

VAR a = CALCULATE(

MAX('stg kronos'[ENDDTM]),

FILTER(

ALLEXCEPT('stg kronos','stg kronos'[EMPLOYEEID],'stg kronos'[PAYCODENAME]),

'stg kronos'[ENDDTM] < EARLIER('stg kronos'[ENDDTM])

)

)

Var b = IF('stg kronos'[ENDREASON]="missedOut",a,'stg kronos'[STARTDTM])

Return IF(b=BLANK(),'stg kronos'[STARTDTM],b)

 

Above query runs perfectly on the sample table but when we run it on the production table, Power Bi throws memory allocation error.

 

We tried to resize VM from 8Gb to 32Gb to 64Gb but we still got the same error.

Also, we increased the cache memory to 54000mb ie 54Gb.

 

Currently, I'm running power bi on VM with 64Gb of Ram and the total row count is 1.2 million.

 

We took help from the support and advisory on which they suggested that the CALCULATE function is the problem here.

 

Sample pbix file and error screenshot

https://drive.google.com/drive/folders/1Wz51npWQ-8gZjgJ_fXUtPbhWYIW_mWdl?usp=sharing

 

Over here I want to calculate a column which will give me the date of the previous record enddate when ENDREASON is missed out and when it is out it will give the startdate.

 

Trying to break the first half of the query to analyze the problem!

MicrosoftTeams-image.png

 

Screenshot (1121).png

 

Expected output

Screenshot (117).png

 

@amitchandak 

@Tahreem24 

7 REPLIES 7
Anonymous
Not applicable

@Nimai123  would you mind sharing how you connected your Kronos data? Was it using the REST API an if so how did you do this?

Anonymous
Not applicable

Hi @Nimai123 ,

 

How about modify your formula as below.

Final 2 =
VAR a =
    CALCULATE (
        MAX ( 'stg kronos'[ENDDTM] ),
        FILTER (
            ALLEXCEPT ( 'stg kronos', 'stg kronos'[EMPLOYEEID], 'stg kronos'[PAYCODENAME] ),
            'stg kronos'[ENDDTM] < EARLIER ( 'stg kronos'[ENDDTM] )
        )
    )
RETURN
    IF (
        'stg kronos'[ENDREASON] = "missedOut"
            && a <> BLANK (),
        a,
        'stg kronos'[STARTDTM]
    )

Or split it to two cloumns.

a =
CALCULATE (
    MAX ( 'stg kronos'[ENDDTM] ),
    FILTER (
        ALLEXCEPT ( 'stg kronos', 'stg kronos'[EMPLOYEEID], 'stg kronos'[PAYCODENAME] ),
        'stg kronos'[ENDDTM] < EARLIER ( 'stg kronos'[ENDDTM] )
    )
)

b =
IF (
    'stg kronos'[ENDREASON] = "missedOut"
        && a <> BLANK (),
    a,
    'stg kronos'[STARTDTM]
)

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

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

Hey @Anonymous 

 

I tried splitting the columns but still, I am getting the same error, because I guess so the problem lies with the calculate function (the logic is correct) as it is taking more time to load in the backend as shown in the screenshot!

 

@amitchandak 

@Tahreem24 

@Anmolgan 

@az38 

Tahreem24
Super User
Super User

@Nimai123 ,

Try to increase the Maximum allowed to 16000 under File / Options and Settings / Options / Global / Data Load.  Data Cache Management Options.

Capture.PNG

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Hi @Tahreem24,

 

We tried that as well by increasing the cache memory to 54000 Mb but still we are getting the same error.

 

About the production thing, we are running the DAX query on the table with approx 12 lakhs rows. 

 

Note - Created a VM with 64Gb Ram and throwing memory allocation error after increasing the cache memory size.

Thanks @Tahreem24  for the response on the thread

 

We have increased the cache size up to 54000 which is equivalent to 54 GB

 

The file which you are using contains the sample data and the screenshot for the error from the production database which is causing the memory issue.

 

 

@Nimai123 ,

I have opened your file at my side and havent got any such error.

First thing, there is no issue with CALCULATE. If it's running fine with your one enviornment so how can you say that there is a issue with CALCULATE while running into production ???

Second thing, there is no issue with DAX. Your issue is related with memeory/cache size. 

I can successfully run your file and DAX at my side wihtout any error.  (see the below SS)

Capture.PNG

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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