- Issue created by @ciesinsg
- πΊπΈUnited States andileco
Hi @ciesinsg, this really just an issue with views - it's not great at aggregating on this field. Try it with a table display, and you will have the same issue. Here's a question that's similar to yours: https://drupal.stackexchange.com/questions/181900/aggregating-by-date-field
I think there are a bunch of relatively easy code-based fixes...are you comfortable working in PHP?
- π¨π¦Canada ciesinsg
Hi @andileco, I am okay with PHP, but I found a solution that worked in views alone, although I had to compromise and enable stacking on my column chart. I'll include the solution below in case other users find it useful.
Solution
As with other Charts, it's best to start off with a table as this can later be changed to a Chart once you're happy with how the table looks.
1. Enable Aggregation as this will be needed for next steps
2. Add the "Authored on" field and set the aggregation to group results. I named this one "Month" as it will show the month name once all the steps are followed.
3. Add the "Authored on" field once again, but this time set the aggregation to count distinct. I named this one "Submitted" as it results in how many change requests exist that month.
4. Add additional data columns. In my case, I added the "Success" field which is a list with "Fully successful", "Partially successful" and "Unsuccessful" where only one option can be selected. Set the aggregation to group results.
5. Add a new Sort Criteria. I added "Authored on" here and set the granularity to "Month" which is what ends up sorting the previously defined fields into months and allows the chart to chart the data monthly.
6. Change the format to chart. In my case, I set this to be a column chart as it shows monthly data in an easy to read way.
7. Change the chart settings. I set the label to be "Month". I also enabled stacking which is what resulted in the chart showing actually useful data. Finally I added submitted and success as data fields.Stacking
This is for anyone not familiar with stacking. Essentially, as the name implies, this stacks data points with multiple possibilities into a single column. In my case, each change request can be set to either fully successful, partially successful, or unsuccessful, but the total number of change requests stays the same. This results in a column on the chart that stackks different colors representing how many fall into the different success categories. All together, they add up to the total number of change requests, so one column is able to show both the total number submitted per month, and how many fall into each different category. It is not as easy to read as separate columns representing each success, however it takes up far less space and actually looks much nicer in my opinion. The main benefit of this is that instead of having 3 columns for each month, which would result in 36 columns, it can show the same data in only 12 columns.
- Status changed to Closed: works as designed
about 1 year ago 4:00pm 26 February 2024