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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
michael_knight
Post Prodigy
Post Prodigy

Count X Filter Help

Hi,

 

I'm having problems with one of my measures. 

 

Total Disqualifed - 3rd party - No Spam & Duplicates = COUNTX(FILTER('Lead',( 'Lead'[Disqualified Reason] = "Cannot Contact" ||
'Lead'[Disqualified Reason] = "Not Interested" || 
'Lead'[Disqualified Reason] = "Wrong Number"  &&
'Lead'[Enquiry Source] = "Facebook" &&
'Lead'[Enquiry Source] = "Email Campaign" && 
'Lead'[Enquiry Source] = "Twitter") && 
'Lead'[statecode] = 2), [statecode])

 

 I'm trying to count the amount of values there are from all the above

 

I have another measure that works and counts the amount of disqualified from Twitter, Email Campaign and Facebook

 

Total Disqualified - 3rd Party = COUNTX(FILTER('Lead',( 'Lead'[Enquiry Source] = "Twitter" ||
'Lead'[Enquiry Source] = "Email Campaign" || 
'Lead'[Enquiry Source] = "Facebook") && 
'Lead'[statecode] = 2), [statecode])

 

 

I think the problem is that I'm doing something wrong when using multiple different fields in the same measure

 

Can anoyone help me with the issue?

 

Thanks,

Mike

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @michael_knight 

I think it is the && conditions stacking on each other filtering out all reults.  GIve this a try:

Total Disqualifed - 3rd party - No Spam & Duplicates =
COUNTX (
    FILTER (
        'Lead',
			'Lead'[Disqualified Reason] IN ( { "Cannot Contact", "Not Interested", "Wrong Number" } )
			&& 'Lead'[Enquiry Source] IN ( { "Facebook", "Email Campaign", "Twitter" } )
			&& 'Lead'[statecode] = 2
    ),
    [statecode]
)

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @michael_knight 

Is this problem sloved? 
If it is sloved, could you kindly accept it as a solution to close this case?
If not, please let me know.
 
Best Regards
Maggie
RandyPgh
Resolver III
Resolver III

The working calculation that you provide pulls results where the Enquiry Source is either Facebook, Email Campaign, or Twitter. The top not-working calculation requires that Enquiry Source be all three of these, because it uses && (AND). I am guessing that you probably want the logic below which instead uses an || (OR) connection for those fields. If not, please provide more explanation of the goal.

 

Note that using the IN operator simplifies the code.

 

Total Disqualifed - 3rd party - No Spam & Duplicates =

    COUNTX (

        FILTER (

            'Lead',

         'Lead'[Disqualified Reason] IN { "Cannot Contact", "Not Interested", "Wrong Number" }  &&

            'Lead'[Enquiry Source] IN { "Facebook", "Email Campaign", "Twitter" } &&

                'Lead'[statecode] = 2

       ),

      [statecode]

    )

 

 

jdbuchanan71
Super User
Super User

Hello @michael_knight 

I think it is the && conditions stacking on each other filtering out all reults.  GIve this a try:

Total Disqualifed - 3rd party - No Spam & Duplicates =
COUNTX (
    FILTER (
        'Lead',
			'Lead'[Disqualified Reason] IN ( { "Cannot Contact", "Not Interested", "Wrong Number" } )
			&& 'Lead'[Enquiry Source] IN ( { "Facebook", "Email Campaign", "Twitter" } )
			&& 'Lead'[statecode] = 2
    ),
    [statecode]
)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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