cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

## Cumulative Sum which resets based on a custom fiscal quarter

I've searched and searched and haven't found a thread with a solution that works for my specific issue.  I have a table with 1 million+ rows of sales data.  I need to create a measure that will give me the cumulative total of closed deals for each quarter.   I have a Sales Data table and a Calendar table that are related through [Close Date] from the Sales Data table and [DayOfCalendarDate] from the Calendar table.  My companies fiscal quarters/years don't line up to the normal calendar.  The two closest solutions I've come up with are:

= CALCULATE(SUM('Sales Data'[Value]),FILTER(ALL('Calendar'[DayOfCalendarDate]),'Calendar'[DayOfCalendarDate]<=MAX('Calendar'[DayOfCalendarDate])))
Which gives me a cumulative total, but doesn't reset each quarter

And the other is

= CALCULATE(SUM('Sales Data'[Value]),FILTER(ALL('Sales Data'),  'Sales Data'[Week in Quarter]<=MAX('Sales Data'[Week in Quarter]) ),'Sales Data'[Value] )
Where I created a custom Column in my Sales Data table to show the "Week in Quarter".  This one resets each quarter, but each quarter is the sum of all quarters.

I have a column in the Sales Data table with the fiscal quarter mapped based on the close date, but all my attempts to add that as a filter in the expression haven't helped.

Super User

It's giving you the sum of all quarters because you haven't kept the filter for each quarter in. To fix it, you'll need to add the condition 'Sales Data'[Quarter] = SELECTEDVALUE('Sales Data'[Quarter]) or something like that into formula.