Forum Discussion
Anonymous
7 years agoNot applicable
Measure Zero not equal to Zero
Hello, I have total sales measure which is sum of sales for the selected period. Then I'm calculating another measure on top of it to identify products with non zero sales. Even when total sales ...
- 7 years ago
Hi,
Try these measures
Total Sales = SUM(Sheet1[sales])
Non Zero Product Sales = CALCULATE(DISTINCTCOUNT(Sheet1[productid]), FILTER(VALUES(Sheet1[productid])),[Total Sales] <>0))
Hope this helps.
Anonymous
7 years agoNot applicable
Anonymous
You have a basic logic/concept mistake.
You need to sum the sales by ID.
Something like
Column Non Zero Product Sales =
VAR TOTAL_SALES_PER_PRODUCTID =
CALCULATE (
SUM ( Sheet1[sales] ),
FILTER (
Sheet1,
Sheet1[productid]
= EARLIER ( Sheet1[productid] )
)
)
RETURN
IF (
TOTAL_SALES_PER_PRODUCTID = 0,
0,
TOTAL_SALES_PER_PRODUCTID
)And then work according to the results in that column.
It will give you 0 for ID 4,5.
Then Count
Non Zero Product Sales =
CALCULATE (
DISTINCTCOUNT ( Sheet1[productid] ),
FILTER (
Sheet1,
Sheet1[Column Non Zero Product Sales] <> 0
)
)
Thanks!
A