Forum Discussion

CarlBlunck's avatar
CarlBlunck
Resolver I
2 years ago

Keepfilters issue

Hi team,

I don't fully understand keepfilters and I think I need to use it.  In a report, I have the following measures:

 

Measure 1 = 

PlannedHolidays =
CALCULATE (
    [PlannedScheduledHours],
    KEEPFILTERS(fact_FutureSchedule[Paycode-level2]
        IN {
        "Additional Annual Leave",
        "Annual Recreation Leave",
        "Long Service Leave",
        "Purchased Leave"
    })
)
 
Measure 2 = 
PlannedOtherLeave =
CALCULATE (
    [PlannedScheduledHours],
    fact_FutureSchedule[Paycode-level1] = "Leave",
    NOT fact_FutureSchedule[Paycode-level2]
        IN {
        "Additional Annual Leave",
        "Annual Recreation Leave",
        "Long Service Leave",
        "Purchased Leave",
        "Personal Leave"
    }
)
 
Now the problem I am having is that the keep filters is working as I want it to in measure 1, but I can't figure out how to add to measure 2 so it will do the same thing I want.
 
What I want is that when I select a value from a slicer that has the fact_FutureSchedule[Paycode-level2] column in it, my visuals stop showing the values from measure 1 and 2 unless, the item chosen in fact_FutureSchedule[Paycode-level2] is one of the items listed in the measure.
 
How can I update measure to so it also uses keep filters?
 
Thanks
Carl
 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi CarlBlunck ,

     

    Please try this.

     

    Measure 2 = 
    PlannedOtherLeave =
    CALCULATE (
        [PlannedScheduledHours],
        FILTER(ALL(fact_FutureSchedule),
        fact_FutureSchedule[Paycode-level1] = "Leave" &&
        NOT fact_FutureSchedule[Paycode-level2]
            IN {
            "Additional Annual Leave",
            "Annual Recreation Leave",
            "Long Service Leave",
            "Purchased Leave",
            "Personal Leave"
        }
    )
    )

     

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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