Forum Discussion

Imthedan's avatar
Imthedan
Icon for Helper II rankHelper II
6 years ago

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

    • Imthedan's avatar
      Imthedan
      Icon for Helper II rankHelper II

      Haha, I meant the values in indentifer are unique.

    • Imthedan's avatar
      Imthedan
      Icon for Helper II rankHelper II

      That didn't fix the issue. It's still returning the same count as before.

  • vivran22's avatar
    vivran22
    Icon for Community Champion rankCommunity 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
    _Count

     

    Cheers!
    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's avatar
      Imthedan
      Icon for Helper II rankHelper 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's avatar
        vivran22
        Icon for Community Champion rankCommunity Champion

        Imthedan 

         

        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