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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
andrearaujo
Regular Visitor

DAX Out of Memory

Hello Everyone, 

Could you guys please help me?

I have a table with customers and products recommended for each customer and the date that the recommend was made, and I would like to calculate the recommended sales that I had for each customer and each product after the recommendation date.

But I'm getting out of memory. There is something wrong in my DAX, or there is another way to do this measure?

 

# Sales After Recommender = 

VAR recommender_date= MINX('recommendations', 'recomendations'[date])

VAR Customer_= SELECTEDVALUE('recomendations'[customer])

VAR Product_ = SELECTEDVALUE('recomendations'[product])

RETURN

CALCULATE([# sales], FILTER(Dates, Dates[FullDateAlternateKey] >= recommender_date), FILTER('dim_Customer', 'dim_Cliente Codigo'[CODIGO] = CLIENTE_), FILTER(dim_PID, dim_PID[PID] = PID_))

Thank you.

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@andrearaujo  try this and see if it improves

 

# Sales After Recommender = 

VAR recommender_date= MINX('recommendations', 'recomendations'[date])

VAR Customer_= SELECTEDVALUE('recomendations'[customer])

VAR Product_ = SELECTEDVALUE('recomendations'[product])

RETURN

CALCULATE([# sales],FILTER(
CROSSJOIN(VALUES(Dates[FullDateAlternateKey]),VALUES('dim_Cliente Codigo'[CODIGO]),VALUES(dim_PID[PID])),
Dates[FullDateAlternateKey] >= recommender_date&&'dim_Cliente Codigo'[CODIGO] = CLIENTE_&&dim_PID[PID] = PID_))

. I guess it can be optimized even further. 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

2 REPLIES 2
v-robertq-msft
Community Support
Community Support

Hi, @andrearaujo 

Have you followed the DAX formula posted by smpa01 to find the improvement to your memory in the desktop?

If so, would you like to mark his reply as a solution so that others can learn from it too?

 

For more info about the DAX formula improvement in the Power BI, please refer to these links:

https://powerbi.microsoft.com/fr-ch/blog/4-recommended-practices-for-new-dax-users/

https://maqsoftware.com/expertise/powerbi/dax-best-practices

https://blog.enterprisedna.co/dax-calculations-in-power-bi-best-practices/

 

Thanks in advance!

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

smpa01
Super User
Super User

@andrearaujo  try this and see if it improves

 

# Sales After Recommender = 

VAR recommender_date= MINX('recommendations', 'recomendations'[date])

VAR Customer_= SELECTEDVALUE('recomendations'[customer])

VAR Product_ = SELECTEDVALUE('recomendations'[product])

RETURN

CALCULATE([# sales],FILTER(
CROSSJOIN(VALUES(Dates[FullDateAlternateKey]),VALUES('dim_Cliente Codigo'[CODIGO]),VALUES(dim_PID[PID])),
Dates[FullDateAlternateKey] >= recommender_date&&'dim_Cliente Codigo'[CODIGO] = CLIENTE_&&dim_PID[PID] = PID_))

. I guess it can be optimized even further. 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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