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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Make DAX formula more efficient

Hi,

 

I have created a DAX formula that works in logic. However, when I run it, the error message appears: 

"There is not enough memory available to perform this operation. Try again later when more memory may be available."

 

The problem is with the DAX formula and I would like to make it more efficient. Would it be enough to add a date filtering or does anyone see a concrete improvement possibility to make the DAX formula run faster?

 

DAX formula:

 

OrdersZSOPA1 = IF( ISBLANK( CALCULATE(max('Sales Invoice Line'[Artikel]),(ALLEXCEPT('Sales Invoice Header','Sales Invoice Header'[Auftrag MCS])),'Sales Invoice Line'[Artikel]="ZSOPA")),1,0)
 
Thank you very much for your help.

 

1 ACCEPTED SOLUTION

@Anonymous Couple things to try:

OrdersZSOPA1 =
  VAR __MCS = DISTINCT('Sales Invoice Header'[Auftrag MCS])
  VAR __Table = FILTER('Sales Invoice Line',[Artike] = "ZSOPA" && [Auftrag MCS] IN __MCS)
  VAR __Count = COUNTROWS(__Table) + 0
RETURN
  IF(__Count = 0, 1, 0) // assumes headers table is connecte via a column called Auftrag MCS

or try something like:

OrdersZSOPA1 =
  VAR __Table = 
    CALCULATETABLE(
      'Sales Invoice Line',
      ALLEXCEPT('Sales Invoice Header','Sales Invoice Header'[Auftrag MCS]),
      'Sales Invoice Line'[Artikel]="ZSOPA"
    )
  VAR __Count = COUNTROWS(__Table) + 0
RETURN
  IF(__Count = 0, 1, 0)


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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

@Anonymous How many rows of data are you dealing with here?



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!:
DAX For Humans

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

@Greg_Deckler  about 700k

Anonymous
Not applicable

@Greg_Deckler  Do you have an idea to simplify the DAX formula?

@Anonymous Couple things to try:

OrdersZSOPA1 =
  VAR __MCS = DISTINCT('Sales Invoice Header'[Auftrag MCS])
  VAR __Table = FILTER('Sales Invoice Line',[Artike] = "ZSOPA" && [Auftrag MCS] IN __MCS)
  VAR __Count = COUNTROWS(__Table) + 0
RETURN
  IF(__Count = 0, 1, 0) // assumes headers table is connecte via a column called Auftrag MCS

or try something like:

OrdersZSOPA1 =
  VAR __Table = 
    CALCULATETABLE(
      'Sales Invoice Line',
      ALLEXCEPT('Sales Invoice Header','Sales Invoice Header'[Auftrag MCS]),
      'Sales Invoice Line'[Artikel]="ZSOPA"
    )
  VAR __Count = COUNTROWS(__Table) + 0
RETURN
  IF(__Count = 0, 1, 0)


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!:
DAX For Humans

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

@Greg_Deckler Thank you, it works fine now! Awsome support Greg!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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