Forum Discussion
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. The measure I'm using to get the customer count is:
Customer Counts = CALCULATE(DISTINCTCOUNT(Connections[Account Number]), Connections[End Fractional] = 0)
The data has some account numbers multiple times if they have multiple services. So I need to pull the total number of account numbers minus duplicates and the "End Fractional" should always be zero. I've put this data in a table and a matrix and still get the same result. I would assume it has to do with the formula but I'm not sure what is incorrect about it.
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
5 Replies
- v-juanli-msftCommunity Support
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
- mattyj2009Helper II
I think this will work if I can figure out the dates. Inside of my data that I pull from I have a date column. I have a slicer that we can change the dates on to pull data for that specific date.
- v-juanli-msftCommunity Support
Hi mattyj2009
Sorry to bother you, would you give some feedback if my solution works for you, if not, what's wrong with it, or is there anything else you need?
Best Regards
Maggie