cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PetervdV
Helper I
Helper I

Insufficient memory after creating new calculated colom

Hi,

 

I have just made these 2 coloms but when entering the code for the last colom PBI gives me an error term saying I have insuffient memory. 

 

I have all other programs closed and I had hoped my laptop has enough memory (4GB) to do most things in PBI.

 

Now I was hoping that someone could help me out to rewrite my code so that it takes less memory or some other tips to help me out.

 

PotentialBenefit =
VAR Hours= (Fct_TV[RemainingWorkHours] + Fct_TV[TotalHoursCumulative])
VAR Adv = Hours RELATED(Dim_Benefit[PayoutPerHour])
RETURN
IF([BenefitByPerson] = RELATED(Dim_Benefit[MaxBenefit]) , ,
IF( Adv >= RELATED(Dim_Benefit[MaxBenefit]) , RELATED(Dim_Benefit[MaxBenefit])-[BenefitByPerson],
IF( Adv <=, 0,
IF(Hours < RELATED(Dim_Benefit[Hourlimit]) , ,
(Adv [BenefitByPerson])
))))

 

 

RemainingWorkHours =
VAR Today= Today()
VAR CALC = (261-DATEDIFF(CONCATENATE("01-01-",Fct_TV[YEAR]),(Today-7),Day)*0.715)*8
RETURN
IF( CALC <0,0,CALC )
 
The code works on a dataset with less data.
The code PotentialBenefit lets me know how many subsidy when can get when a person works for us the remainder of the year.
However there are limit to this "MaxBenefit" and a person most work over more than a certain number of hours "Hourlimit" with Dim_Benefit containing about 30 different rows.
In FcT_TV it says who has worked x number of hours "TotalHoursCumulative" amongst many other items and also a calculation on how much subsidy we can already get for a person taken based on the last time we have data from him. The Calculation  is called "BenefitByPerson" 
 
BenefitByPerson =
CALCULATE( AVERAGE(Fct_TV[AchievedBenefit]),
FILTER(
Fct_TV,
Fct_TV[PeriodID] = CALCULATE( MAX( Fct_TV[PeriodID] ),
FILTER(
Fct_TV,
Fct_TV[CandidateID] = EARLIER( Fct_TV[CandidateID]) )
)))
 
I tried to translate the code to English to make it more readable.
 
Thanks to everyone trying to help in advance.
1 REPLY 1
lbendlin
Super User
Super User

Use DAX Studio (install it if you don't have it yet) and then look at the produced query to see where your cartesian products are greatest (hig numbers of records). Make adjustments to your queries accordingly.  

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors