Forum Discussion
quarterpenny
7 years agoFrequent Visitor
Distinct Count with Cumulative Measure filter
Trying to get a distinct count of category per year, but only where the cumulative value up to the end of the year is NOT zero. See data below. e.g the distinct count of Category at the end of 20...
v-juanli-msft
7 years agoCommunity Support
Hi quarterpenny
Create a calculated column
year = YEAR([Date])
create measures
Measure =
CALCULATE (
SUM ( Sheet8[Value] ),
FILTER (
ALLEXCEPT ( Sheet8, Sheet8[Category] ),
Sheet8[Date] <= MAX ( Sheet8[Date] )
)
)
Measure 2 =
CALCULATE (
DISTINCTCOUNT ( Sheet8[Category] ),
FILTER ( ALL ( Sheet8 ), [year] = MAX ( Sheet8[year] ) && [Measure] <> 0 )
)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- quarterpenny7 years agoFrequent Visitor
Hi Thanks but this doesn't seem correct.........for YTD 2015 the count might be correct but it seems to be referring to Categories B and D, rather than C and D?