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
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
apaulso9
Resolver I
Resolver I

@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?

v-jayw-msft
Community Support
Community Support

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.

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

Hey @v-jayw-msft 

 

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
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.