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

Sum values in column B when value is greater than previous row then group total by column A

Hi PBI community,

 

I have a challenge in that I have the following table as an example:

 

Current Count.PNG

 

From row to row I need to track positive movements while ignoring negative movements, keeping a track of the overall value.

 

In other words, based on the data above I need a new column which ignores decreases in value and sums increases in value leading to the following table with a new column labelled "Total Count":

 

Count.PNG

 

As you can see, the new column ignores decreases in value from the previous row and current row of the "Current Count" column and adds the difference to the total value when there is a positive difference between the previous row and current row of the "Current Count" column.

 

Finally I need the count to reset whenever the ID changes.

 

I have a large dataset (approx 900,000 rows) and so running out of memory might be an issue if using a calculated column.

 

Any help from some of the super users out there would be very much appreciated.

3 REPLIES 3
Cmcmahan
Resident Rockstar
Resident Rockstar

How do you determine the order of each ID?  How do you know the data for ID 1 is in the order 10, 5, 20, 25, 30 if the table gets sorted?

Apologies, there is a column with DateTime values in the real data set which is used to determine the order of the dataset.

This is an example of how the data is sorted...

 

Count 3.PNG

 

Thanks for your help!

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.