Forum Discussion

sglendenning's avatar
sglendenning
Icon for Helper II rankHelper II
2 years ago
Solved

Calculate Active Customers

I have the effective date, expiration date, and void date and I have a date table but it is joined with a different field other than the effective date.

 

When using a matrix visual by year everything looks reasonable until I get to 2024 where 2024 is low.  If I expand the matrix to the month level within a year prior to 2024 I get a much lower number.  The total for the year column prior to 2024 is ok but the month level is not correct.

 

I'm using;

CALCULATE(COUNT(CustomerKey),FILTER(EffectDate<=MAX('Date'[Date])&&ExpireDate>=MAX('Date'[Date])||VoidDate>MAX('Date'[Date])))
  • gmsamborn's avatar
    gmsamborn
    2 years ago

    Hi sglendenning 

     

    Would a measure like this help?

    Active = 
    VAR _Start = MIN( 'Date'[Date] )
    VAR _End = MAX( 'Date'[Date] )
    VAR _Count =
        CALCULATE(
            DISTINCTCOUNT( 'Table'[CustKey] ),
            'Table'[AcqDate] <= _End
                && COALESCE( 'Table'[CancelDate], 'Table'[ExpireDate] ) >= _Start
        )
    RETURN
        _Count

     

    Let me know if you have any questions.

     

    Active Customers.pbix

     

3 Replies