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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Daniel_B
Helper II
Helper II

COUNTIF multiple column criteria selections

Hi All

 

Another simple one I'm hoping to get some help with to boost my learning (YouTube is a minefield!!)

 

I have 2 columns - Sentiment (contains various sentiment values) & Theme (contains themes derived from my made-up data)

 

I want to count the number of times the text "Positive" appears under SENTIMENT in the same row as the word "Person" under THEME so that I can calculate the % of the number of times a Person is considered Positive

 

I've already created a measure for the Total Number of Rows but if there is an easier way of incorporating that into a single formula that would be much better as I want to learn the cleanest method of coding possible 

 

Thanks


Dan_B

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

Hi, @Daniel_B 


If I understand you correctly, you want to divide the number of times a Person is considered Positive by the total number of rows in one formula. In this case , try the following DAX:

 

Result =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', [Sentiment] = "Positive" && 'Table'[Theme] = "Person" )
)
    / 
        COUNTROWS ( 'Table' )
 

 

Please leave a message for any updates. 

Best,
Paul

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

View solution in original post

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

Hi, @Daniel_B 


If I understand you correctly, you want to divide the number of times a Person is considered Positive by the total number of rows in one formula. In this case , try the following DAX:

 

Result =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', [Sentiment] = "Positive" && 'Table'[Theme] = "Person" )
)
    / 
        COUNTROWS ( 'Table' )
 

 

Please leave a message for any updates. 

Best,
Paul

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

kentyler
Solution Sage
Solution Sage

Could you post a small table of sample data and the text of the measure you created?





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.