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

Cumulative Total excluding some data

Hello everyone,

in this table START_Date & END_DATE columns have 3 values or more (values and their sum), I want to get cumulative for sum values only.... thank u for ur helpScreenshot 2022-06-21 131403.png 

 
1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @minasaleh669,

 

You may try this Measure.

CumulativeTotalExcludingData =
VAR cumulativeTotal =
    CALCULATE (
        SUM ( 'Table'[ACT_COST] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[END_DATE] ),
            'Table'[Index] <= MAX ( 'Table'[Index] )  //sum by the order in the screeshot
            //'Table'[WBS_ID] <= MAX ( 'Table'[WBS_ID] ) //sum by WBS_ID ascending
        )
    )
RETURN
    IF (
        MAX ( 'Table'[START_DATE] ) >= DATE ( 2019, 5, 1 )
            && MAX ( 'Table'[START_DATE] ) <= DATE ( 2019, 7, 1 ),
        cumulativeTotal,
        BLANK ()
    )

 

As this Measure calculates cumulative total by the order in the screenshot, you need add an extra index column in Power Query Editor(Transform Date). If you just would like to get cumulative total by the order of WBS_ID ascending, then you can try the annotated code.

 

The result looks like this.

vcazhengmsft_0-1656035494232.png

 

Also, attached the pbix file.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

4 REPLIES 4
v-cazheng-msft
Community Support
Community Support

Hi @minasaleh669,

 

You may try this Measure.

CumulativeTotalExcludingData =
VAR cumulativeTotal =
    CALCULATE (
        SUM ( 'Table'[ACT_COST] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[END_DATE] ),
            'Table'[Index] <= MAX ( 'Table'[Index] )  //sum by the order in the screeshot
            //'Table'[WBS_ID] <= MAX ( 'Table'[WBS_ID] ) //sum by WBS_ID ascending
        )
    )
RETURN
    IF (
        MAX ( 'Table'[START_DATE] ) >= DATE ( 2019, 5, 1 )
            && MAX ( 'Table'[START_DATE] ) <= DATE ( 2019, 7, 1 ),
        cumulativeTotal,
        BLANK ()
    )

 

As this Measure calculates cumulative total by the order in the screenshot, you need add an extra index column in Power Query Editor(Transform Date). If you just would like to get cumulative total by the order of WBS_ID ascending, then you can try the annotated code.

 

The result looks like this.

vcazhengmsft_0-1656035494232.png

 

Also, attached the pbix file.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

tamerj1
Super User
Super User

minasaleh669
New Member

@tamerj1 

Could u help me?

minasaleh669
New Member

@amitchandak 

could u help me!!

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.

Top Solution Authors