I have a data set that looks like this:
foo,R foo,Y bar,C foo,R baz,Y foo,R baz,Y baz,R ...
I'd like to generate a report that sums up the number of 'R', 'Y' and 'C' records for each unique value in the first column. For this data set, it would look like:
foo,3,1,0 bar,0,0,1 baz,1,2,0
Where the 2nd column is the number of 'R' records, the third is the number of 'Y' records and the last is the number of 'C' records.
I know I can first filter by record type, group and aggregate, but that leads to an expensive join of the three sub-reports. I would much rather group once and GENERATE each of the {R, Y, C} columns in my group.
How can I convert the Boolean result of comparing the second column in my data set to 'R', 'Y' or 'C' to a numeric value I can aggregate? Ideally I want 1 for a match and 0 for a non-match for each of the three columns.