cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Regular Visitor

## Filter for data via two columns - return items matching multiple values

Hi There,

I am looking for a filter measure or column syntax on a large table with users and skills where I would need to select/filter a user that has multiple skills and then I want to count a number value in another column.

Here is an example:

In the table example below I would like to get all users that can whistle and jump and sum up the hours for the matching ones.

 User hours Skill user1 2 whistle user2 4 jump user1 3 jump user2 6 eat user3 7 jump

So following the logic the result would be just user1 that can jump and whistle and the hours is 2+3

 user1 5

My attempts all failed so far, its easy to do this when checking for one or the other skill but getting only the ones that have both seems to quite difficult. Any ideas from the experts?

2 ACCEPTED SOLUTIONS
Super User

@kanebuddy

If you insert a slicer for Skill and select the skills the following measure should give you the numbers by users in a visual.

Measure = sum( table[hours])

If you need a measure with the filters then

``````Total Hours =

CALCULATE(
SUM(Table[hours]),
Table[Skill] IN {"jump", "whistle"}
)``````
Did I answer your question? Mark my post as a solution! and hit thumbs up
Community Champion

You can create a measure with below code:-

``````Skill_Hour_Sum =
VAR current_selected_user =
MAX ( skills[User] )
VAR skills_count =
CALCULATE (
DISTINCTCOUNT ( skills[Skill] ),
FILTER (
skills,
AND (
skills[User] = current_selected_user,
OR ( skills[Skill] = "jump", skills[Skill] = "whistle" )
)
)
)
RETURN
IF (
skills_count >= 2,
SUMX ( DISTINCT ( skills[hours] ), skills[hours] ),
BLANK ()
)``````

Best Regards,
Samarth

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

3 REPLIES 3
Community Champion

You can create a measure with below code:-

``````Skill_Hour_Sum =
VAR current_selected_user =
MAX ( skills[User] )
VAR skills_count =
CALCULATE (
DISTINCTCOUNT ( skills[Skill] ),
FILTER (
skills,
AND (
skills[User] = current_selected_user,
OR ( skills[Skill] = "jump", skills[Skill] = "whistle" )
)
)
)
RETURN
IF (
skills_count >= 2,
SUMX ( DISTINCT ( skills[hours] ), skills[hours] ),
BLANK ()
)``````

Best Regards,
Samarth

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

Regular Visitor

Hi Samarth, that worked like a charm. Many thanks for the lighning fast solution!

Super User

@kanebuddy

If you insert a slicer for Skill and select the skills the following measure should give you the numbers by users in a visual.

Measure = sum( table[hours])

If you need a measure with the filters then

``````Total Hours =

CALCULATE(
SUM(Table[hours]),
Table[Skill] IN {"jump", "whistle"}
)``````
Did I answer your question? Mark my post as a solution! and hit thumbs up