Forum Discussion
Count dates for the month and accumulate values
- 6 years ago
Hi pawelk3 -
Start by creating a Date table
DateTab = ADDCOLUMNS ( CALENDARAUTO(), "Year", YEAR([Date]), "Month", MONTH([Date]))Make a relationship between the date table and your data
Create a new measure Cumulative Sales
Cumulative Sales = TOTALYTD(COUNT(Products[ContractDate]), DateTab[Date])This will automatically recalculate the total if a Group is selected
All:
Group G1
Hope this helps
David
- 6 years ago
Oops Sorry! 🙁 Put a parenthesis in the wrong place (remove the one directly after the first instance of DateTab[Date] on the last row, move it to the end of that row).
Cumulative Sales = CALCULATE ( COUNT ( Products[ContractDate] ), FILTER ( ALL ( DateTab ), DateTab[Date] <= MAX ( DateTab[Date] ) ) )
Oops Sorry! 🙁 Put a parenthesis in the wrong place (remove the one directly after the first instance of DateTab[Date] on the last row, move it to the end of that row).
Cumulative Sales =
CALCULATE (
COUNT ( Products[ContractDate] ),
FILTER ( ALL ( DateTab ), DateTab[Date] <= MAX ( DateTab[Date] ) )
)
HI,
I have a same type of question, but in my case I want to calculate the accumulated values only for a given year in a date tabell, selected from a slicer. How do I limit the calculation to only a selected year?
Best regards
Tove
- dedelman_clng6 years ago
Community Champion
Hi Fia123 if you look back up in the thread, the first marked solution has the details and the formula that "resets" every year.