Forum Discussion
DistinctCount Calculation going slow upon 7 day average calculation
try like this:
DistinctApprovalRate =
VAR _Dis = SUMX(VALUES(Transactions[customerId]),1)
RETURN
CALCULATE(
_Dis,
Transactions[FinalApproval]=1)/_Dis)
- Anonymous3 years agoNot applicable
Hmm, Tried this a couple times in a couple different measures to differientiate it. The issue that I run across with using this method is that the CALCULATE(_Dis, Transactions[FinalApproval] = 1) Does not actually provide any filter on the SUMX Variable
- Anonymous3 years agoNot applicable
Update:
Looks like DAX does not do any filters on any Variables. I tried the similar solution that I had with COUNTROWS() and it did not provide the filteringApprovedDistinctCustomers2 = VAR _Dis = COUNTROWS(VALUES(AuthRate[CustomerID])) RETURN CALCULATE( _Dis, AuthRate[FinalApproval] = 1)Edit: After looking at Variables in DAX a bit further, it looks like they are all constant/static variables that cannot be changed once created. Makes sense from a functional programming perspective but I've been told by my dev team that dax likes variables for speeds so that sucks but makes sense why, because it's all static so ofcourse it's fast lol.