Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards
SOLVED

Deriving Countif in a query

Avatar

Level 2

How to use countif in workflow/query? I am trying to get to the highlighted values (count of states that have a a group value greater than 0). 

 

countif.png

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @rntrp ,

I'm not entirely sure of your full use case or how you plan to use the final result, but based on your question, here’s an approach I would suggest:

  1. Import the file (or query the data if it's already in a table).

  2. Use a Split activity and define three sub-conditions based on your logic — for example, where Column A is not zero, Column B is not zero, and Column C is not zero. * Enable the data over lap from setting of split activity. So all data flow from each condition. 

  3. This will give you three separate outputs from the Split activity.

  4. After each Split output, you can retrieve the row count using the variable vars.recCount.

  5. This will give you the number of records for each condition — essentially your final result.

If your goal is data reporting or analysis, this approach should help. However, if you plan to use this data for another specific purpose, feel free to share more details.

Note: SQL GROUP BY works on row-level data. Since you are trying to analyze column-based conditions (e.g., count of non-zero values in specific columns), a standard SQL query won't be sufficient. You'll need to handle it at the workflow logic level as described.

Hope this helps!

Kind regards,
Parvesh

Parvesh Parmar – Adobe Community Advisor
https://www.linkedin.com/in/parvesh-parmar/

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @rntrp ,

I'm not entirely sure of your full use case or how you plan to use the final result, but based on your question, here’s an approach I would suggest:

  1. Import the file (or query the data if it's already in a table).

  2. Use a Split activity and define three sub-conditions based on your logic — for example, where Column A is not zero, Column B is not zero, and Column C is not zero. * Enable the data over lap from setting of split activity. So all data flow from each condition. 

  3. This will give you three separate outputs from the Split activity.

  4. After each Split output, you can retrieve the row count using the variable vars.recCount.

  5. This will give you the number of records for each condition — essentially your final result.

If your goal is data reporting or analysis, this approach should help. However, if you plan to use this data for another specific purpose, feel free to share more details.

Note: SQL GROUP BY works on row-level data. Since you are trying to analyze column-based conditions (e.g., count of non-zero values in specific columns), a standard SQL query won't be sufficient. You'll need to handle it at the workflow logic level as described.

Hope this helps!

Kind regards,
Parvesh

Parvesh Parmar – Adobe Community Advisor
https://www.linkedin.com/in/parvesh-parmar/

Avatar

Level 2

Thank you. This approach worked.