Forum Discussion

fazza1991's avatar
fazza1991
Helper II
4 years ago

DAX Measure Not Summing

Hi,

 

I have tried everything to get this measure to give me an accurate total sum.

 

LostCustomers(2) 
VAR CustomersPurcahsed = CALCULATETABLE(VALUES(P[ACCOUNT_ID]),
FILTER(ALL('Date'),
'Date'[Date] > MIN ('Date'[Date]) - 90 &&
'Date'[Date] < MIN ('Date'[Date]) - 30 ))
VAR PriorCustomers = CALCULATETABLE(VALUES(P[ACCOUNT_ID]),
FILTER(ALL('Date'),
'Date'[Date] > MIN ('Date'[Date]) - 60 &&
'Date'[Date] < MIN ('Date'[Date])))
RETURN
COUNTROWS(EXCEPT(CustomersPurcahsed,PriorCustomers))
 
Used HASONEFILTER combined with SUMX, COUNTX but all results give me some aggregates which is not what i am expecting.
 
ALternatively a column formula for lost customers between in a period is more than suitable

4 Replies

  • smpa01's avatar
    smpa01
    Community Champion

    fazza1991  does this help?

    LostCustomers(2) 
    VAR CustomersPurcahsed = CALCULATETABLE(VALUES(P[ACCOUNT_ID]),
    FILTER(ALL('Date'),
    'Date'[Date] > MIN ('Date'[Date]) - 90 &&
    'Date'[Date] < MIN ('Date'[Date]) - 30 ))
    VAR PriorCustomers = CALCULATETABLE(VALUES(P[ACCOUNT_ID]),
    FILTER(ALL('Date'),
    'Date'[Date] > MIN ('Date'[Date]) - 60 &&
    'Date'[Date] < MIN ('Date'[Date])))
    RETURN
    COUNTX((EXCEPT(CustomersPurcahsed,PriorCustomers)),P[ACCOUNT_ID])
    • fazza1991's avatar
      fazza1991
      Helper II

      Hey,

       

      Afraid not. Only gives me the total of the first month 

       

       

       

  • Your measure looks reasonable. Can you post some sample data along with what you're getting versus what you expect to get?