Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Filtering based on filtered values

Hi All,   I am stuck in a problem. Here are the details. I have a sales data which has sales with customer name and order date fields. I need to count customer which were active 4 months ago but ar...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    You can create a calculated column as below:

    Active customer = 
    VAR _maxorddate =
        CALCULATE ( MAX ( 'Table'[Date] ), ALL ( 'Table' ) )
    RETURN
        CALCULATE (
            MAX ( 'Table'[Customer] ),
            FILTER (
                SUMMARIZE (
                    'Table',
                    'Table'[Customer],
                    "ConL", CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Customer] ) )
                ),
                DATEDIFF ( [ConL], _maxorddate, MONTH ) < 4
            )
        )

    If the above one is not applicable for your scenario, please provide your expected result with more explanation. Thank you.

    Best Regards