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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
bflaviu
Regular Visitor

Filter COUNTROWS Where Values Equal Values from Another Table

I am tracking KPIs for some sales reps, so I have a table of all the sales calls they made witih a column that shows what sales method they used (Cold Calls, Meeting, Etc.)  Each sales rep has chosen a single type of method, and and goal number of calls for that method they must make a week, so in another table, I have the Sales Rep, the Method Type, and the Goal Number.  I want to create a measure, where I count only the sales calls from the Sales Calls table that match the chosen type for that sales rep as defined in the KPI table.

 

Tables.JPG

 

So I want to get a count from Sales Calls where if I chose the context of "John", it only counts the rows where the 'Sales Calls'[Method] = 'KPI Settings'[KPI Method] for John (so count all the "A" calls for Jonh, "A" calls for Bob, and "B" calls for Tim).

 

The tables are related by Sales Rep.

 

Thanks in advance! 

 

Flaviu

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

How about these 2 Measures?

 

Total Calls = COUNTROWS(SalesCalls)

KPI Method Calls =
CALCULATE (
    [Total Calls],
    FILTER (
        SalesCalls,
        SalesCalls[Method] = RELATED ( 'KPI Settings'[KPI Method] )
    )
)

EDIT: I used M1 (A) , M2 (B), M3 (C)

COUNTROWS - RELATED.png

View solution in original post

2 REPLIES 2
Sean
Community Champion
Community Champion

How about these 2 Measures?

 

Total Calls = COUNTROWS(SalesCalls)

KPI Method Calls =
CALCULATE (
    [Total Calls],
    FILTER (
        SalesCalls,
        SalesCalls[Method] = RELATED ( 'KPI Settings'[KPI Method] )
    )
)

EDIT: I used M1 (A) , M2 (B), M3 (C)

COUNTROWS - RELATED.png

That worked perfectly!  Thanks!  I was really confused about how the RELATED function worked.  I was getting lost trying to use LOOKUPVALUE function.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.