0

Countif with Groupby

Hi - I am creating a table that displays different country codes in the first column (e.g. GB, DE, AUT, etc.). In the second column, I want to show all open tickets for the respective country code. Therefore, I have a data source that contains a row with the values "open" and "closed" for each ticket assigned to a specific country code. 

Now, in Klipfolio, I use the following formula: GROUPBY(slice(@country_code), COUNTIF(@status="open")).

Unfortunately, the result does not even come close to the correct number of open tickets for each country code.

Do you have any idea how I can fix this problem? 

Thank you!

1 comment

  • 0
    Avatar
    Claire Jones

    Hi Georg, 

    Thanks for posting in our community! 

    You can try adding Select functions to your GroupBy function and using the method parameter set to count:

    GroupBy ( Select ( @country_code, @status = "open") , Select ( @status, @status = "open"), Count)

    This should keep the open statuses aligned with the country codes.

    You can watch the video below for a demonstration of how to use GROUPBY with the method parameter:

    Using GROUPBY with the Method parameter

    Hope this helps!

    Please don't hesitate to email us at support@klipfolio.com for further questions. 

    Claire

     

Please sign in to leave a comment.