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
newgirl
Helper V
Helper V

Cumulative Total in Calculated Column

Hello! I have sample table below and I tried to make a calculated column to compute for the cumulative total per Count grouping per month.

Below is my screen shot of my PBIX where the results do not show correctly while second picture shows he expected results I need.

 

I already tried using ALLSELECTED instead of ALL and EARLIER instead of MAX, but it still doesn't work.

 

Cumul = 
CALCULATE( SUM('Table'[SubTotal_Vol]),
FILTER(ALL('Table'[Date]),'Table'[Date] <= MAX('Table'[Date])))

 

PBIXPBIX

 

Expected ResultsExpected Results

 

Not sure if this info helps, but my Date column is just a combination of Month and Year and then converted data type into Date.

 

Cumul3.JPG

1 ACCEPTED SOLUTION
newgirl
Helper V
Helper V

I was able to use this formula:

Cumul = 
CALCULATE(SUM('Table'[SubTotal_Vol]),
FILTER(ALLEXCEPT('Table','Table'[Merged]), 'Table'[Date]<= EARLIER('Table'[Date]) && 'Table'[Merged] <= MAX('Table'[Merged])))

View solution in original post

5 REPLIES 5
HavenerTed
Frequent Visitor

Hello all,

 

I was wonderfing if there is a way to get the cumulative column by employee and/or project number? RIght now I have the cumulative column which generates a sum much greater than it should be but when it is in measure format it works correctly. Essentially, I am trying to cumulative hours per employee instead of the whole entire company.

 

Let me know what you may have to help.

 

Thank you.

newgirl
Helper V
Helper V

I was able to use this formula:

Cumul = 
CALCULATE(SUM('Table'[SubTotal_Vol]),
FILTER(ALLEXCEPT('Table','Table'[Merged]), 'Table'[Date]<= EARLIER('Table'[Date]) && 'Table'[Merged] <= MAX('Table'[Merged])))

Hi! I am wondering, what is the Merged variable that you are using in your solution?

Hello! The Merged column is the merging of 2 columns in which how I grouped them. For example, I consider INLAND100 as one group, RETAILER327 as another, which helped compute for the cumulative for that group.CapturePBI.JPG

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @newgirl - I think you need

VAR _Date = MAX([Date]) 
ALLSELECTED()

REMOVEFILTERS([Date])

FILTER (  [Date] <= _Date)

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.