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
Anonymous
Not applicable

not enough memory for a specific column?

Hey, 

 

I am having some trouble with an equation, I have a column of data for TotalEnergy, and this column accumulates all the energy in total for different devices, and I wanna make a column for that takes current value minus previous for a specific device, I had a function that worked well: 

 

NewEnergyPer300s_kWh =
VAR minIndx = CALCULATE (
MAX ( Data[Index] ),
ALLEXCEPT ( Data, Data[Device] ),
Data[Index] < EARLIER (Data[Index] )
)
 
RETURN
 
IF (
ISBLANK ( minIndx ),
BLANK (),
Data[TotalEnergy_kWh]
    - CALCULATE (
               SUM ( Data[TotalEnergy_kWh] ),
                   Data[Index] = minIndx,
                       ALL ( Data )
)
)

 

 

It does eaxctly what I want it to do, BUT Iam getting an error saying there is not enough memory capacity, it works fine when I filter it down to one device for example, but not with several. (There is only 71.000 rows of data aswell!) Is it possible to write this as a measure maybe? Or is there any other way I can write it?

 

Also I have started to try this equation, but I don't know where to add so it it just for the specific device, this equation only takes current value minus previous row undependent on what device it is: 

 

NewEnergyPer300s2_kWh =
Var BaseValue = Data[TotalEnergy_kWh]
Var BaseDate = Data[EndUtc]
Var DateCheck = LOOKUPVALUE(Data[EndUtc], Data[Index], Data[Index]-1)
Var ValueToSubtract = IF('Data'[Index]=0, Data[TotalEnergy_kWh], LOOKUPVALUE(Data[TotalEnergy_kWh], Data[Index], Data[Index]-1))
RETURN
IF(FORMAT(BaseDate, "YYYY-MM-DD HH:mm")= FORMAT(DateCheck, "YYYY-MM-DD HH:mm"), IF(ISBLANK(ValueToSubtract), BaseValue-BaseValue, BaseValue-ValueToSubtract),BaseValue-BaseValue)
 
 
Any tips or ideas on how I can change it?
 
Kind regards Agnes
 
 
 
5 REPLIES 5
Anonymous
Not applicable

I have tried this formula as well, and I am trying to change Index to Rank, but I am not getting correct values. 
 
NewEnergyPerDay_kWh =
var maxIndex =CALCULATE( MAX('Data'[Index]), FILTER('Data','Data'[Index]=EARLIER('Data'[Index])), ALLEXCEPT(Data,Data[Device]))
VAR minVal='Data'[TotalEnergy_kWh]
var maxVal= IF('Data'[Index]=maxIndex,
LOOKUPVALUE('Data'[TotalEnergy_kWh],'Data'[Index],'Data'[Index]),
LOOKUPVALUE('Data'[TotalEnergy_kWh],'Data'[Index],'Data'[Index]+1))
RETURN
CALCULATE(DIVIDE(minVal-maxVal,1,0),FILTER('Data','Data'[Index]=EARLIER('Data'[Index])), ALLEXCEPT(Data,Data[Device]))
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may try to add a rank column instead of index for the specific device for your data. Then you may use the second way as you said. Please check my formula in below post. If you need further help,please share some data sample.

 

https://community.powerbi.com/t5/Desktop/Time-Taken-for-a-ticket-in-Audit-log/m-p/586239#M277826

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks!

 

I am doing the rankx formula, but I can't use the formula in to calculate the energy, I just get the answer I can't use it as a multiple scalar, (It gets many ranking number that will be the same, as for I have five different products, I willl get 5 different Rank 1), Is it possible to use the RankX for this question then? 

 

I want a formula that take the value minus the value of previous index for that product. 

 

Kind regards

Anonymous
Not applicable

Hi, 

 

thanks, but I don´t understand why a ranked column would be better then the index, where would I even put in the formula? Also do you know why the first one wont work?

 

Kind regards 

Hi @Anonymous

 

It seems an issue with memory. Here is the article for your reference. You may try to optimize your model and formula.  If you could share the file, it would be better for us to help further on it.

 

Regards,

Cherie

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

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.