Forum Discussion
Cumulative Line Formula
- 10 years ago
You should be able to use the formula that Greg_Deckler provided and just change the SUM to a COUNT of [Planned] or [Actual].
Cummulative Actual Line = CALCULATE ( COUNTA ( 'Table1'[Actual] ), FILTER ( ALL ( 'Table1' ), 'Table1'[StartofMonth] <= MAX ( 'Table1'[StartofMonth] ) ) )
Cummulative Planned Line =
CALCULATE (
COUNTA ( 'Table1'[Planned] ),
FILTER (
ALL ( 'Table1' ),
'Table1'[StartofMonth] <= MAX ( 'Table1'[StartofMonth] )
)
)Here is what I generated with your example data set.
The general cumulative total pattern can be found here:
http://www.daxpatterns.com/cumulative-total/
Basically it is:
Cumulative Quantity :=
CALCULATE (
SUM ( Transactions[Quantity] ),
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date] <= MAX ( 'Date'[Date] )
)
)I would have to see your specific data, or sample data and relationships to write a specific solution or your model.
- MWitkin10 years agoFrequent Visitor
Here a sample of the data:
The report I showed an image of has bars that count the number of dates in the "Planned" and "Actual" columns and show them in bars to show the difference in the two counts. The "StartOfMonth" column is used to group the bars together by each month in the 'Shared Axis' field of the BI report. All columns are in one table.
- Twan10 years agoAdvocate IV
You should be able to use the formula that Greg_Deckler provided and just change the SUM to a COUNT of [Planned] or [Actual].
Cummulative Actual Line = CALCULATE ( COUNTA ( 'Table1'[Actual] ), FILTER ( ALL ( 'Table1' ), 'Table1'[StartofMonth] <= MAX ( 'Table1'[StartofMonth] ) ) )
Cummulative Planned Line =
CALCULATE (
COUNTA ( 'Table1'[Planned] ),
FILTER (
ALL ( 'Table1' ),
'Table1'[StartofMonth] <= MAX ( 'Table1'[StartofMonth] )
)
)Here is what I generated with your example data set.
- MWitkin10 years agoFrequent Visitor
I implemented the formulas suggested above, but the numbers illustrated don't seem to match up to the numbers on the bars.
You can see the line value at the highlighted point is 8,370 while the bars is hovers by are both only showing a value of 15. It seems to just be doubling it's count of every item in the data set (there are about 550 total items in the data set by their dates span over a long period of time).
Did I miss a step?
Judging by the image Twan showed of his solution, that formula should work perfectly.
- jb1018 years agoNew Member
Thanks, this worked perfectly for what I needed.
- Anonymous8 years agoNot applicable
I used the formula but it is not limiting based on the Visual Filter.
Here is my formula:
Rev_Local_Cummulative =
CALCULATE (_Revenue[Revenue_LocalCurrency] ,
FILTER (
ALL ( DateInvoice[CalendarDate] ),
'DateInvoice'[CalendarDate] <= MAX ( 'DateInvoice'[CalendarDate] )
)
)I have a Visualization Filter set to June 2018. June 1 starts out with the sum of all prior data and then increments by the current filtered month daily amount.