Forum Discussion

alya1's avatar
alya1
Icon for Helper V rankHelper V
1 year ago
Solved

report set up for dates help (dynamically find days since separation/lookup hours based on slicer)?

Hi all this might be a complicated question, apologies! I'm trying to use multiple source tables to create a report that shows customer points earned and used that DYNAMICALLY filters based on a sli...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi alya1 

     

    Based on your description, it seems that you are trying to calculate the point earned and used results for active users, whereas active accounts are dynamically determined based on the slicer. Please correct me if I'm misunderstanding.

    Create the following measures:

    IsActive = 
    CALCULATE(
        IF(
            AND(
                MIN('customer summary'[start date]) <= MAX('autocalendar'[Date]),
                OR(
                    ISBLANK(MIN('customer summary'[end date])),
                    MIN('customer summary'[end date]) >= MIN('autocalendar'[Date])
                )
            ),
            1,
            0
        ),
        FILTER(
            'customer summary',
            'customer summary'[customer ID] = MAX('customer summary'[customer ID])
        )
    )
    PointsEarned = 
    CALCULATE(
        SUM('customer summary'[pts earned]),
        'customer summary'[start date] <= MAX('autocalendar'[Date]),
        OR(
            ISBLANK('customer summary'[end date]),
            'customer summary'[end date] >= MIN('autocalendar'[Date])
        )
    )
    PointsUsed = 
    CALCULATE(
        SUM('customer points history'[points]),
        'customer points history'[points date] <= MAX('autocalendar'[Date])
    )
    ActiveCustomers = 
    CALCULATE(
        COUNTROWS('customer summary'),
        'customer summary'[start date] <= MAX('autocalendar'[Date]),
        OR(
            ISBLANK('customer summary'[end date]),
            'customer summary'[end date] >= MIN('autocalendar'[Date])
        )
    )

    Create a table visual and apply the filter: "IsActive is 1" in the Visual Filters panel.

     

     

    Best Regards,
    Jarvis Tang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.