Forum Discussion

KG1's avatar
KG1
Resolver I
2 years ago

Incorrect Total in Matrix

Hi

 

I have a simple measure = 

Distinct Count Invoices = DISTINCTCOUNT('All Oracle Invoices Processed'[INVOICE_NUM])
 
There are no filters needed
 
The matrix totals are incorrect
 
The month / year is from a date table and the values are summarised from a category table  (Simple data model)
 

 

 

 

The correct table should look like this

 

 
 

1 Reply

  • The numbers are "wrong" in the matrix most likely because on a few occasions, the same invoice number occurs in different months in the data. They are distinctly counted under each month they occur in (so the same invoice num will be counted for instance in july and in august, but in the total column they will only be distinclty counted once for the entire period) so the total is less than if you just added up all the numbers in the columns.


    If this is not expected from your data then you should keep your measure the same and have your datasource fixed so that each invoice num only occurs in a single month.

    If this is expected, and the expected result you want to show is the one in your excel sheet (which is counting some of the same invoice nums multiple times) then you need to modify your measure like so:

    Distinct Count Invoices = 
    
    VAR t =
        SUMMARIZE (
            'All Oracle Invoices Processed',
            All Oracle Invoices Processed[Date],
            "DistInvoice", DISTINCTCOUNT('All Oracle Invoices Processed'[INVOICE_NUM])
        )
    RETURN
        SUMX ( t, [DistInvoice] )

    This formula I found in another solution here.
    You may need to edit the Summarize function to include the categorical column that constitutes the rows in your screenshot.

    I have made a simple test dataset (without the categories) and it worked fine:

    Result:

    correct total being the formula aboce, distinct invoice being the initial simple formula you wrote. The data as reference:

    I hope this helps!