Forum Discussion
Getting count based on multiple column criteria (countifs for excel)
Hello!
I have a table that has call date, call status and identifer.
What I want to do is create a measure that will count rows based on call status and identifer. Identifer is a unique value, but there will be blank rows in that column as well.
For example, I need to find how many times call status of "Appointment" and identifer WASN'T blank. Doesn't matter what the value is in identifier, it just cannot be blank.
This is what I came up with. It's giving me too many results and not sure why.
Appointments = CALCULATE(COUNTROWS(RAW_EXPORT),RAW_EXPORT[CallStatus] = "Appointment",FILTER(RAW_EXPORT,NOT(ISBLANK(RAW_EXPORT[identifier]))))
thank you for any help!
9 Replies
- lbendlin
Super User
"Identifer is a unique value, but there will be blank rows in that column as well."
Thank you, I needed that chuckle.
Since your IDs are supposedly unique you can use this DAX function
https://docs.microsoft.com/en-us/dax/distinctcountnoblank-function-dax
- vivran22
Community Champion
Hello Imthedan
You may try this:
Count Not Blank = VAR _Filter = FILTER( 'Table', NOT ISBLANK('Table'[Identifier]) && 'Table'[Call Status] = "Appointment" ) VAR _Count = CALCULATE(COUNTROWS('Table'),_Filter) RETURN _CountCheers!
Vivek
If it helps, please mark it as a solution. Kudos would be a cherry on the top 🙂
If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)
Blog: vivran.in/my-blog
Connect on LinkedIn
Follow on Twitter- Imthedan
Helper II
Sorry for the late response! I was out of town for the week avoiding the smoke from the wildfires in my area.
I appreciate the help! Would it be possible to get that in a DAX solution? I am trying to force myself to learn it and knowing how to count a condition based on mutliple criteria in DAX would go a long way for me.
Thank you!
- vivran22
Community Champion
Sorry to know about your situattion. Hope everything is fine now.
The solution I had shared is a for creating Measures using DAX. If you can share more details on your requirement/problem, then I can share more specific solution.
Feel free to connect with me.
Cheers!
Vivek
Blog: vivran.in/my-blog
Connect on LinkedIn
Follow on Twitter