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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Optimize DAX memory

Im currenly having an issue with VAR data. When i try to run this with all that dax measurements i run out of memory. As you can see i only have 7 measurments in this because i couldnt figure out which measurement was causing me the issue. Unfortunately, its this one. Does anyone know of a diffrent way of attiving this? basically i want to subtract the previous dimension with the current dimension. these are based on time stamps. so in excell it would be =ABS ( A2-A3). Something like that but because power bi is not set up like this i had to make another equation basically to get the dates in order (which is the second picture). I cant imagine this is that big for power bi which leads me to believe that its how i wrote the DAX measurment.

 

Any help would be appreciated Capture.PNGCapture1.PNG

5 REPLIES 5
Greg_Deckler
Super User
Super User

Sample data. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Unfortunately, I cant post the actually data due to privacy issues nor can i give you the actual file that im working with.  I undertand how that would make it eaiser to answer my question. Apologize for the little information to go off of.

Anonymous
Not applicable

Could you clearly explain what you are trying to do in this measure? I'd like to know, for instance, why you are using ALLSELECTED and why there is no Date/Calendar table in your design.

Also, please go to www.daxformatter.com and format the measure properly so that people can read it.

Thanks.

Best
D
Anonymous
Not applicable

Moving Range =
IF (
    ISBLANK ( 'eOVL Data - MySQL'[Earlier Time1] ),
    BLANK (),
    (
        VAR EarlierTime =
            CALCULATE (
                MAX ( 'eOVL Data - MySQL'[TimeStamp] ),
                FILTER (
                    ALLSELECTED ( 'eOVL Data - MySQL'[TimeStamp] ),
                    'eOVL Data - MySQL'[TimeStamp]
                        < SELECTEDVALUE ( 'eOVL Data - MySQL'[TimeStamp] )
                )
            )
        VAR EarlierMeasureValue =
            CALCULATE (
                SUM ( 'eOVL Data - MySQL'[Measured Value] ),
                'eOVL Data - MySQL'[TimeStamp] = EarlierTime
            )
        RETURN
            ABS ( EarlierMeasureValue - SUM ( 'eOVL Data - MySQL'[Measured Value] ) )
    )
)

 

This should now be a proper dax equation. All selected is becasue i have slicers that need to be used. I know this will slow down Power bi also but i need the. Basically there is thousands of part numbers that this is looking through and the time in which they were measured. Its let putting them in order from oldest to newest. Its then getting the diffrence between measurments. If your familiar with stats, its a moving range chart. The equations that i use work when the data that is pulled isnt huge but when I pull from our SQL database instead of an excel workbook it takes 20 min.

Anonymous
Not applicable

Oh, and there is a date table you just couldnt see it in the Snip-it that was sent.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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