Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 217117

COUNTDISTINCT on an Aggregation

$
0
0

Hello,

 

I've written a simple COUNTDISTINCT mesaure that runs into issues when in aggregate, the totals of a customer rows equals zero.

 

I want to count the number of distinct customers in a month, that have sales > 0. Where I run into an issue is when the sales in aggregate for one customer equals 0 as it's not considering the sum of all the rows for the one customer. As is, my current measure is Count  Customers=CALCULATE(COUNTDISTINCT[Customer Name]),[Sales]>0))

 

Example:

 

Customer Name Sales Month
XYZ Sailing 100 1/1/2017
XYZ Sailing 100 1/1/2017
XYZ Sailing -100 1/1/2017
XYZ Sailing -100 1/1/2017
XYZ Sailing 50 1/1/2017
XYZ Sailing -50 1/1/2017

How would I get COUNTDISTINCT to evaluate the rows in aggregate versus row by row. Is there any easy way to accomplish this without a customer table? 

 

Thank you!

 

 


Viewing all articles
Browse latest Browse all 217117

Trending Articles