Forum Discussion

mattyj2009's avatar
mattyj2009
Helper II
8 years ago
Solved

Subtotal Not Calculating Correctly

When doing a subtotal with measure customer counts we are getting an incorrect value.  From the data it is showing we should have a subtotal of 4577 and what the actual subtotal is showing is 4554.  ...
  • v-juanli-msft's avatar
    8 years ago

    Hi mattyj2009

    Create a calculated column

    Column = CALCULATE(DISTINCTCOUNT(Sheet1[account]),FILTER(ALLEXCEPT(Sheet1,Sheet1[area]),[end]=0))

    Create a measure

    discount =
    VAR filtered =
        FILTER ( ALLEXCEPT ( Sheet1, Sheet1[area] ), [end] = 0 )
    VAR countb =
        CALCULATE ( DISTINCTCOUNT ( Sheet1[account] )filtered )
    RETURN
        IF (
            HASONEVALUE ( Sheet1[area] ),
            countb,
            SUMX ( VALUES ( Sheet1[Column] ), [Column] )
        )

     

    Best Regards

    Maggie