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
Dan492813
Helper II
Helper II

Count the volume of "contact_no" only when it contains specific records

Hey all, I'm trying to only count the number of "contact_no" where any of the actions (they all start with "C200" ) appear within that record. 

 

If it doesn't contain any "C200" I dont want it to count them.

 

Count stage 2 = CALCULATE(COUNTAX(hgmcntct,hgmcntct[contact_no]), FILTER(hgmcntac, hgmcntac[action_cd] = "C2001" || hgmcntac[action_cd] = "C2002" || hgmcntac[action_cd] = "C2003" || hgmcntac[action_cd] = "C2004" || hgmcntac[action_cd] = "C2005" || hgmcntac[action_cd] = "C2006" || hgmcntac[action_cd] = "C2007" || hgmcntac[action_cd] = "C2008"))
 
Thanks, Dan
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Dan492813 
Please try

Count stage 2 =
SUMX (
    VALUES ( hgmcntct[contact_no] ),
    IF (
        NOT ISEMPTY (
            FILTER (
                CALCULATETABLE ( VALUES ( hgmcntac[action_cd] ) ),
                CONTAINSSTRING ( hgmcntac[action_cd], "C200" )
            )
        ),
        1
    )
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Dan492813 
Please try

Count stage 2 =
SUMX (
    VALUES ( hgmcntct[contact_no] ),
    IF (
        NOT ISEMPTY (
            FILTER (
                CALCULATETABLE ( VALUES ( hgmcntac[action_cd] ) ),
                CONTAINSSTRING ( hgmcntac[action_cd], "C200" )
            )
        ),
        1
    )
)

You're a star tamerj1 as always.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors