Cumulative Sum seems to crossjoin?

db 21 Reputation points
2023-01-09T22:33:04.333+00:00

I have a metric which is a Cumulative Sum of Items based on the number of months since a batch of items was created. Incremental Items are the number of items added to the batch each month with month zero being the initial month. So batch 899486 had 329 items during it's initial month (Cumulative 329), 2 after one month (Cumulative 331) and zero month 2 (Cumulative 331). Incremental Item is a field in the database and is a simple sum. Cumulative_Items is defined as

Cumulative_Items:=  
  
        CALCULATE ([Incremental_Items],  
                    FILTER( ALLSELECTED('MonthsOutstanding'[MonthsOutstanding]), ' MonthsOutstanding '[MonthsOutstanding] <= max(' MonthsOutstanding '[MonthsOutstanding]))  
  
                  )  
  

The issue is that the batches shown in red do not have entries for months 1 and 2 but i'm getting crossjoin of some type. The problem is the subtotal for months one and two are wrong. I use the total in a downstream calculation. For instance, the total for month 2 should be 839. Can anyone see what I'm missing? MonthOutstanding is a dimension and 1:M to the fact table. Same way with batch.

277580-sample.jpg

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,344 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alexei Stoyanovsky 3,416 Reputation points
    2023-01-10T10:59:11.493+00:00

    That's no moon, sorry, no crossjoin. It's just your cumulative calculation doing its thing, that is, summing all the values from month 0 to current. Apparently you want the calculation to ignore batches that haven't been added to in the current month. One things that stands out here is that in your data, a batch can have either NULL or 0 items added, and these cases seem to be treated differently. A subtle problem is what you want your grand total to be. Your measure needs to be coded differently to fulfill these requirements, but first you'll have to decide what logic you want to implement, exactly.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.