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
frandb
New Member

Subtract rows from a cumulative column value

Hi !

 

I'm having an issue calculating the difference between the value of two succesives rows as shown in the image. For example I want to substract the values of the column "Cons 1 kWh" for every row at every consecutive time.

I´ve tried several ways that I´ve found in the forum but none of them solved my problem successfuly. As an example I´ve tried to create an index column to use as a guide in de DAX code but the data base is always refreshing so afeter a few minutes the index column isn´t correct any more.

 

Could you help me please?

 

Thanks !

 

Recorte foro.PNG

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@frandb

 

Try this column

 

Column =
VAR RowWithPreviousTime =
    TOPN (
        1,
        FILTER ( Table1, Table1[DATETIMEPLC] < EARLIER ( Table1[DATETIMEPLC] ) ),
        [DATETIMEPLC], DESC
    )
RETURN
    Table1[Cons 1 kWh] - MINX ( RowWithPreviousTime, [Cons 1 kWh] )

Regards
Zubair

Please try my custom visuals

@frandb

 

See attached file as well

 

subtract.png


Regards
Zubair

Please try my custom visuals

Thanks !

But running the answer you told me this message apears: "There's not enough memory to complete this operation. Please try again later when there may be more memory available."

 

I think this problem is due to the excesive amount of data I have to process (1.700.000 rows).

Do you have an other idea?

Hi @frandb,

 

How do you connect your data source? Direct Query or Impot?

 

What 's size of your RAM space? From the message, it seems that you may add your RAM Space.

 

In addition, to get the better performance, you may need to optimize your data model.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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.