Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
kanebuddy
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.

 

UserhoursSkill
user12whistle
user24jump
user13jump
user26eat
user37jump

 

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

user15

 

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
Fowmy
Super User
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


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

Samarth_18
Community Champion
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 ()
    )

 

Samarth_18_1-1626187939478.png

 

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

3 REPLIES 3
Samarth_18
Community Champion
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 ()
    )

 

Samarth_18_1-1626187939478.png

 

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

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

Fowmy
Super User
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


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.