Posted: 2011-09-07 15:26 |
Using the Group Concatenate functionality is one of the most useful techniques to learn when reporting in Workbooks as it enables you to identify records that do not include certain pieces of information rather than ones that do. Two other Forum articles that look at this subject may be helpful:
Another example is to identify Organisations which do NOT have a particular Product in their Contract. Here's how:
GROUP_CONCAT( order_line_items.product.refcode SEPARATOR ', ')
You'll now have a report showing only those Organisations which do NOT have a particular product in their Contract. |
Posted: Fri, 09.09.2011 - 10:37 |
Hi, Thanks for posting this; I have one question though. I have tried to create a report like this but some of our contracts have blank product codes, which still get eliminated by the 'does not contain' filter. Is there a way to make a criteria for 'does not contain X OR is NULL'? I tried a few different combinations but have not worked it out yet. Thanks! |
Posted: Fri, 09.09.2011 - 13:14 |
Hello,
This article explains the topic of Reporting on NULL or Blank values.
Hopefully that helps but let us know if not. |
Posted: Fri, 09.09.2011 - 16:53 |
Sorry, I didn't explain very well. I have already tried what it suggests there, but it does not seem to work when I combine NULL with an actual value (here product 'X')? Thanks |
Posted: Mon, 12.09.2011 - 08:14 |
There's more than one way you could approach this but here's one suggestion, which should work nicely. Essentially, you want a column that will tell you whether or not the Contract has a Line Item with a Product Code of 'Product X' or where the Product Code is blank. Remember that blank can be NULL or ''. Next, you'll want to see the results concatenated into one row, for which you can use GROUP CONCAT. It's fine to create this formula all in one go, but for ease of explaining what's going on, I'm breaking it out into two columns. So, first you'll need to create an IF statement that uses OR, that looks something like:
The formula above looks at the Product Code and if that code is either null, blank or is 'Product X', it returns a 1, otherwise it returns a 0. (You can, of course, use terms other than 1 or 0 - just use whatever makes sense to you and remember that if you want to use a text string you need to put apostrophes around it.) Next, use the above formula within GROUP_CONCAT so that all the results show on one line, as follows:
As described in an earlier post, if you click Refresh Preview you'll now just see one row of data so open the Summarise By tab and use the Object Reference to summarise on. Finally, apply a calculated criterion. Remember, you just want to see the records for which the Product Code is null, blank or is 'Product X' so apply a calculated criterion to the relevant column (ie, the one that you've Group Concatenated) using the Contains operator and then type in the word you've used to identify the relevant records. In the example I've used, it looks like the screenshot below. |