Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Filter a measure by multiple expressions

hi all,

 

I was hoping someone could help me find a way to filter one of my measures by multiple expressions.

 

I am trying to find out the employee utilisation for different job titles within my team

 

ive done the head of service like this 

 

UTHOS = CALCULATE([UTE],
                   FILTER(POT1,POT1[Position] = "HOS"))

 

it returns the utilisation as defined by the measure for the Head of service 

 

I need to find out the  utilsation for the rest of the team, ive tried 

 

ALLTEAM = CALCULATE([UTE],
FILTER(POT1,POT1[Position] = "C,AC,GC,SC"))

 

but it returns a blank graph any advice would be much appreciated

  • Anonymous's avatar
    Anonymous
    8 years ago

    Try this:

     

    ALLTEAM =
    CALCULATE (
        [UTE],
        POT1[Position] IN { "C", "AC", "GC", "SC" }
    )

    Also, if more POT1[Position] values may eventually be added, this measure won't work (since you've hardcoded all of the values in).

     

    You could simply ignore "HOS" if you wanted to:

     

    ALLTEAM =
    CALCULATE (
        [UTE],
        POT1[Position] <> "HOS"
    )

    You don't need the FILTER() function, since CALCULATE() can handle comparing a column to a static value.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Try this:

     

    ALLTEAM =
    CALCULATE (
        [UTE],
        POT1[Position] IN { "C", "AC", "GC", "SC" }
    )

    Also, if more POT1[Position] values may eventually be added, this measure won't work (since you've hardcoded all of the values in).

     

    You could simply ignore "HOS" if you wanted to:

     

    ALLTEAM =
    CALCULATE (
        [UTE],
        POT1[Position] <> "HOS"
    )

    You don't need the FILTER() function, since CALCULATE() can handle comparing a column to a static value.

    • Anonymous's avatar
      Anonymous
      Not applicable

       I had no idea about the IN function I also didn't release you dont need filter with calculate.

       

      Thanks for your help, its much appreciated