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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
NickzNickz
Helper IV
Helper IV

How to get cumulative amount and cumulative % for Overall and based on Slicer

Hi ... 
I have created table profit and data as below:

DateCollection ($)Costing ($)Profit ($)
30/1/20234,0009,421(5,421)
24/2/202322,50017,0775,423
10/3/202325,50018,1577,343
11/3/202327,00021,1835,817
7/4/20231,9507,301(5,351)
1/6/20233,0009002,100
31/7/202312,7506,9785,772
31/7/20236,0005,197803
12/8/202332,00021,67810,322
5/9/202311,0004,7826,218
5/9/20234,5503,980570
23/10/20233,0004,556(1,556)
23/10/202331,5007,41124,089
24/10/20239000900
3/1/20245,0003,3391,661
9/1/20245,5003,2882,212
20/1/20244,0002,0271,973
29/1/20244,0002,0271,973
4/2/202417,00012,4444,556
10/2/20248,2507,728522
16/2/202415,00014,061939
20/2/202425,50010,24115,259

 

Based on above data, I need to create a measure for Cumulative Profit ($) and Cumulative Profit (%).
My dashboard setup, I have Year Slicer (dropdown / Multi-select with CTRL), Table, Card and Line Chart.
How can I get the value based on my slicer selection (All or Year Selected).
Regards,

NickzNickz

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @NickzNickz ,

You can create the measure as below to get it, please find the details in the attachment.

Cumulative Profit ($) = 
CALCULATE (
    SUM ( 'Table'[Profit ($)] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date] <= SELECTEDVALUE ( 'Table'[Date] )
    )
)
Cumulative Profit (%) = 
VAR _all =
    CALCULATE ( SUM ( 'Table'[Profit ($)] ), ALLSELECTED ( 'Table' ) )
RETURN
    DIVIDE ( [Cumulative Profit ($)], _all )

vyiruanmsft_0-1708590064932.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @NickzNickz ,

You can create the measure as below to get it, please find the details in the attachment.

Cumulative Profit ($) = 
CALCULATE (
    SUM ( 'Table'[Profit ($)] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date] <= SELECTEDVALUE ( 'Table'[Date] )
    )
)
Cumulative Profit (%) = 
VAR _all =
    CALCULATE ( SUM ( 'Table'[Profit ($)] ), ALLSELECTED ( 'Table' ) )
RETURN
    DIVIDE ( [Cumulative Profit ($)], _all )

vyiruanmsft_0-1708590064932.png

Best Regards

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the  below picture and the attached pbix file.

 

Jihwan_Kim_1-1708490230796.png

 

 

 

Jihwan_Kim_0-1708490110838.png

 

Profit: = 
SUMX(Data, Data[Collection ($)]-Data[Costing ($)])

 

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

Cumulative profit %: = 
VAR _allselectedprofit =
    CALCULATE (
        [Profit:],
        WINDOW (
            1,
            ABS,
            -1,
            ABS,
            ALLSELECTED ( 'Calendar'[Date], 'Calendar'[Year]),
            ORDERBY ( 'Calendar'[Date], ASC )
        )
    )
VAR _cumulativeprofit =
    CALCULATE (
        [Profit:],
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALLSELECTED ( 'Calendar'[Date], 'Calendar'[Year] ),
            ORDERBY ( 'Calendar'[Date], ASC )
        )
    )
RETURN
    IF (
        NOT ISBLANK ( [Profit:] ),
        DIVIDE ( _cumulativeprofit, _allselectedprofit )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim ,

 

I am not sure how your semantic model looks like > My date data in the same table.
How can I get value of Cumulative Profit ($).


Btw do i need to create additional column for Year and Month. My date is in Date level and my data in dashboard is by Month and my slicer is in Year.

Example:

NickzNickz_0-1708491562035.png

NickzNickz_1-1708491650076.png

Regards,

NickzNickz

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.