This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I'm with you, I can't think of a basic built in function to do this, the best i can do is to use a formula and summaraize tool. I don't know if it'll help but take a look at the sample attachment. It essentially tags a new field based on contains t/f and then sums that column.
What I have done is create an iterative macro that moves through each field defined in the range, by a checkbox, and checks whether the provided expression is True or not for each row. As the rows will have variable names I have specified that the user should use __field__ as their variable. i.e. __field__ = 1. I think that it should be relatively quick as you don't have to transpose anything but mainly I think it is a flexible solution that easily accepts changes in workflows.
I will concede that I spent too much time on it, if anyone has a better way of doing the iterative column selection I would be interested to hear it. Also if someone can tell me why I had to use iteration_number+ 2 selection, that would also be helpful. I think it is to do with my count field moving position but I cannot tell why that would happen.
Wondering if any more condensed solutions have been found to this question. In my case, I'm looking to filter on values that are present in a separate file. I've summarized the value (which in my example is called "Placement") in the ref sheet, and now want to filter a separate input file on Placement by saying, "only give me placements which are present in the ref sheet." Any thoughts?
Explanation: lines 1 and 3 simply pass data back and forth from/to Alteryx. So the "Count If" is just one line of code...
df[,"countIf"] <- rowSums(df[,1:9]==0)
...which is: adding a new column "countIf" to the dataset, which is assigned the row-wise sum over existing columns 1 to 9 where any of those columns is equal to zero. The sum is on the boolean "equality" which happens to be 1 when true and 0 when false; therefore you could supply any condition here.