Forum Discussion
DAX Counting subscribers by start/end dates taking too long
- 5 years ago
Anonymous , replace calculate in one of the three ways
CALCULATE (
SUM ( Subscriptions[MatchingRecords] ),
FILTER (Subscriptions, Subscriptions[Start Date] <= currentDate
&& Subscriptions[End Date] >= currentDate ) ,
ALLEXCEPT(Subscriptions, Subscriptions[Active], Products[Product Description])
)or
CALCULATE (
SUM ( Subscriptions[MatchingRecords] ),
FILTER (Subscriptions, Subscriptions[Start Date] <= currentDate
&& Subscriptions[End Date] >= currentDate ) ,
ALLEXCEPT(Subscriptions, Subscriptions[Active]),allexpect(Products, Products[Product Description])
)or
CALCULATE (
SUM ( Subscriptions[MatchingRecords] ),
FILTER (allselected(Subscriptions), Subscriptions[Start Date] <= currentDate
&& Subscriptions[End Date] >= currentDate && Subscriptions[Active] = max( Subscriptions[Active])) ,
filter(allselected(Products), Products[Product Description] =max( Products[Product Description]))
)need of allexcept on Subscriptions[Active] ?
Anonymous , replace calculate in one of the three ways
CALCULATE (
SUM ( Subscriptions[MatchingRecords] ),
FILTER (Subscriptions, Subscriptions[Start Date] <= currentDate
&& Subscriptions[End Date] >= currentDate ) ,
ALLEXCEPT(Subscriptions, Subscriptions[Active], Products[Product Description])
)
or
CALCULATE (
SUM ( Subscriptions[MatchingRecords] ),
FILTER (Subscriptions, Subscriptions[Start Date] <= currentDate
&& Subscriptions[End Date] >= currentDate ) ,
ALLEXCEPT(Subscriptions, Subscriptions[Active]),allexpect(Products, Products[Product Description])
)
or
CALCULATE (
SUM ( Subscriptions[MatchingRecords] ),
FILTER (allselected(Subscriptions), Subscriptions[Start Date] <= currentDate
&& Subscriptions[End Date] >= currentDate && Subscriptions[Active] = max( Subscriptions[Active])) ,
filter(allselected(Products), Products[Product Description] =max( Products[Product Description]))
)
need of allexcept on Subscriptions[Active] ?
I'm not sure i do need the allexcept to be honest - it was just in an example i found on here. I think you're right. It's not needed. I'll give those a go and find out 🙂
Thanks,
Alex