Forum Discussion

Big_Trucks's avatar
Big_Trucks
Frequent Visitor
6 years ago
Solved

Cumulative Column Summation

Hi All,

 

I am having trouble getting my Dax to calculate for what I need. The values need to be in a column, in order to line up with other items in my table for filter calculations. I have tried the common formula listed below with no success. 

 

 

Cumulative sales =
CALCULATE (
    SUM ( 'YourTable'[Sales] ),
    ALL ( 'YourTable)' ),
    'YourTable'[Date] <= EARLIER ( 'YourTable'[Date] )
)

 

 

I added a screenshot of my table below. The Quarterly sum expected should be a summation of the quarterly budget values (which is a measure). The closest I have been able to come is from the following code

 

 

***Quarterly SUM Expected Cumulative = 
CALCULATE(
SUMX (
    SUMMARIZE (
        'Table1',
        'Table1'[** Budget Utilization]
    ),
    [** Quarterly Budget]
),FILTER(ALL('Date Table'),'Date Table'[Year QTR] <= MAX('Date Table'[Year QTR]))
)

 

 

Thanks

  • Big_Trucks - 
    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

     

    That said, you might try this:

    ***Quarterly SUM Expected Cumulative = 
    VAR __Dates = FILTER(ALL('Date Table'),'Date Table'[Year QTR] <= MAX('Date Table'[Year QTR]))
    SUMX (
        SUMMARIZE (
            FILTER('Table1',[Date] IN __Dates),
            'Table1'[** Budget Utilization]
        ),
        [** Quarterly Budget]
    )

7 Replies