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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Sadia-A
New Member

Add Column to calculate running profit for each row from profit column

Hi

I am in learning stage of Power BI. I came across a problem. I have a table with 2 column namely: Entry_date and profit. I want to add a Cumm Profit2 column which can calculate running total profit for each row except for the 1st row as it will remain the same. If you refer to the picture the Cumm Profit2 is not matching Cumm Profit. Kindly point out the Mistake.

problem.png

1 ACCEPTED SOLUTION
yasharma221195
Frequent Visitor

Hello,

Make sure you first understand the concept of row and filter context first,

 

Here replace sales column to "Profit" column, sheet1 with your table name and date with "Entry date"

 

Cumulative Sum  =
SUMX(
    FILTER(
        ALL(Sheet1),
        Sheet1[Date] <= EARLIER(Sheet1[Date])
    ),
    Sheet1[Sales]
)

Logic - I want to have filtered table in such a way that it will give rows older dates than the selected date row  and do the sum for that filtered table.

View solution in original post

3 REPLIES 3
yasharma221195
Frequent Visitor

Hello,

Make sure you first understand the concept of row and filter context first,

 

Here replace sales column to "Profit" column, sheet1 with your table name and date with "Entry date"

 

Cumulative Sum  =
SUMX(
    FILTER(
        ALL(Sheet1),
        Sheet1[Date] <= EARLIER(Sheet1[Date])
    ),
    Sheet1[Sales]
)

Logic - I want to have filtered table in such a way that it will give rows older dates than the selected date row  and do the sum for that filtered table.

Thank you for help

Rupak_bi
Resolver II
Resolver II

try to modify the formula with below

1.     filter(all(table)
2.      "MIN" to be replaced to "Max". 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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